fastfox has asked for the wisdom of the Perl Monks concerning the following question:
I'm having a little trouble with a small script (the first I wrote in Perl), but not the "standard" way I guess.
I'm creating a tarball from a folder, gzipping it afterwards:
$tarball = "backup_".$time_stamp.".tar"; open(TAR, "$tar cf $tarball $dir/* |"); close(TAR); $gzfile = $tarball.".gz"; open(FILE, $tarball); binmode FILE; $gz = gzopen($gzfile, "wb"); while (my $by = sysread (FILE, $inh, 4096)) { $gz->gzwrite($inh); } $gz->gzclose();
That works well, also the mail which I send with the .gz as attachment works, but then my mail provider refuses to recieve an attachment with an archive within an archive. Is there any trick to get the folder directly into a .gz ?
Thanks for any tips !
CheerS
fastfox
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: gzipping folder without tarring it first
by Corion (Patriarch) on May 06, 2010 at 14:29 UTC | |
by fastfox (Initiate) on May 06, 2010 at 14:57 UTC | |
by BrowserUk (Patriarch) on May 06, 2010 at 15:00 UTC | |
by fastfox (Initiate) on May 06, 2010 at 15:09 UTC | |
Re: gzipping folder without tarring it first
by moritz (Cardinal) on May 06, 2010 at 14:26 UTC | |
Re: gzipping folder without tarring it first
by BrowserUk (Patriarch) on May 06, 2010 at 14:48 UTC | |
Re: gzipping folder without tarring it first
by gloryhack (Deacon) on May 06, 2010 at 16:15 UTC |