Need help writing a script that will unzip and then untar files from a series of directories
by kaplan71 from LinuxQuestions.org on (#592N6)
Hello --
We have a large number of tgz files that are to be unzipped, and then untarred for general use. To complicate matters, each of these files is in its own directory as shown below:
Quote:
A for loop script should work here, but I need help in crafting it to do the following:
1. Go into each directory to do the gunzip and subsequent tar extract.
2. The extracted folders from each directory should all be sent to another folder.


We have a large number of tgz files that are to be unzipped, and then untarred for general use. To complicate matters, each of these files is in its own directory as shown below:
Quote:
ll 001 && ll 000001 && ll 000012 total 25040 -rw-r--r--. 1 root root 25640121 Oct 30 2017 000_matroxx_Sep_17_2010.tgz total 7220 -rw-r--r--. 1 root root 7391131 Oct 30 2017 000000_TEST2BED_Aug_21_2010.tgz total 4 -rw-r--r--. 1 root root 333 Oct 30 2017 000011_Configuration__EPIX_Oct_01_2010.tgz |
1. Go into each directory to do the gunzip and subsequent tar extract.
2. The extracted folders from each directory should all be sent to another folder.