Shell Script to Decompress and Rename Files Spread Over Entire Filesystem
Posted on 2008-06-22
There are files spread over an entire filesystem compressed with bzip2. They are all named similar to a010013l.afm.z where a010013l.afm is the proper name of the uncompressed file.
When uncompressed via gzip2 -d a010013l.afm.z (for example), the output file is a010013l.afm.z.out. Again, the proper output name for this file is a010013l.afm
The first task of the script is, given a directory (which may or may not be /) to recursively step through all child directories looking for .z files. It should then uncompress them, search for a .out file matching the file that was just uncompressed and rename it, removing the .z.out from the name.