Problem
I have noticed that SCO software is sometimes distributed in a
tar archive format that contains compressed files (even though
the filenames do not have ".Z" suffixes). When the tar archive
is extracted, the tar utility will automatically use the uncompress
utility to uncompress the files when required. How do I create
such a tar archive of compressed files? Solution
Follow these steps:1. Compress files individually using the compress command. For example:
# compress thisfile2. Strip the ".Z" extension from the file names. You may want
to make use of the expr or basename commands to do this.
For example:# mv thisfile.Z `basename thisfile .Z`3. Create the tar archive using a capital "C" instead of the small "c" function to flag to tar that files are compressed.
# tar Cv . # here the archive is created on
# the default device in /etc/default/tar,
# usually the primary floppy driveThe more detailed example below assumes that you want to compress all of the files in the subdirectory structure named "/tmp/myfiles" and copy them to a tar archive on tape:
# cd /tmp/myfiles# find . -type f -print | xargs compress# find . -type f -name '*.Z' -print |
> xargs -i expr '{}' : '\(.*\).Z' |
> xargs -i mv {}.Z {}# tar Cv8 . # assuming that "8" references the
# correct device in /etc/default/tarWhen the compressed files are subsequently extracted by the
tar utility, they will be automatically uncompressed. See also
tar(C), compress(C), expr(C), xargs(C)