I am a perl newbie who is trying to write a script to automate a
task.
I have a large collection of compressed archives (mostly .tar.gz,
tar.bz2, tar.Z, .tgz etc). This are stored in a number of directories
/ sub-directories).
I am looking for a script that will recursively extract a single file
from each of these archives e.g. the file INSTALL, for the extracted
file to be moved to a different location and renamed to the name of
the archive itself, but keeping the same directory structure;
e.g.
Suppose I have archives files, x.tar.gz, y.tar.gz, and x.tar.Z in
/home/peter/a/
and in /home/peter/a/b/ files ab.tar.gz, b.tar.bz2, c.tgz
I would like the script to recursively extract the INSTALL from all of
these files, for the INSTALL files to be copied to /tmp, and renamed
to the name of the archive, so that in
/tmp/a/ there will be files named x.tar.gz, y.tar.gz, and x.tar.Z
(which are just the relevant INSTALL files), and in /tmp/a/b/ files
ab.tar.gz, b.tar.bz2, c.tgz (again these files to be just the INSTALL
files).
I appreciate that tar -zf name.tar.gz -x <file name> extracts just a
file, but it creates directories etc, which mean the above is
unworkable.
Would be really grateful for any help you can give. Please bear in
mind that I am not very technically minded.
Thanks,
Peter
pe****************@fastmail.fm