in reply to Re: creating .tar.gz file
in thread creating .tar.gz file

The second solution looks promising, some time back I was to do the same, here it goes
$cmd="tar -cvf xyz.tar xyz.txt 2>&1"; system($cmd);
This creates a archive named xyz.tar containing xyz.txt then
$cmd="gzip xyz.tar 2>&1"; system($cmd);
will create the xyz.tar.gz file for you!!

The world is so big for any individual to conquer

Replies are listed 'Best First'.
Re^3: creating .tar.gz file
by bart (Canon) on Oct 31, 2007 at 12:42 UTC
    If your tar supports it, the you can make tar directly invoke gzip in one command, creating a .tar.gz file in one go, using the -z command line switch.
Re^3: creating .tar.gz file
by Bloodnok (Vicar) on Oct 31, 2007 at 13:46 UTC
    ... or even (from memory, which at my time of life ain't what it used to be) ...

    `tar -cv xyz.txt | gzip -c > xyz.tgz`;
    At last, a user level that best describes my experience :-))