find and unzip selected sub folders in tar.gz files
there are few hundred tar.gz files each having several sub dirs in them (ex: ftp_server1_logs, mail_server2_logs). However the main tar.gz files (ex: 20101001.tar.gz) does not contain all sub dirs every time (ex: 20101001.tar.gz may only contain some ftp server log dirs etc..)
what i have to do is find the tar.gz files that contain a specific type of log type (ex: ftp logs) and extract all logs to a single folder (ex: ftp logs) any help on this (with specific command line options) is highly appreciated. thanks |
I would do something like this (probably not the most elegant, but it works). It needs to be tweaked if you have duplicate filenames within the archives, and will leave you with some empty directories after the extract/move, but should be easy enough to clean up.
Code:
#!/bin/bash |
All times are GMT -5. The time now is 09:54 PM. |