blackadder has asked for the wisdom of the Perl Monks concerning the following question:
which works fine on the ".gz" but it can't handle ".z" files!#! c:/perl/bin/perl.exe # By me- March 2007 use strict; use Archive::Tar; #use Archive::Zip; system(cls); my $tar = Archive::Tar->new(); opendir (DIR, $ARGV[0]) || die "\nHey, gimme a path to work with pleas +e!\n"; my @dirs = readdir (DIR); unlink ("$ARGV[0]\\modinfo.txt"); foreach my $dir (@dirs) { next if ($dir eq '.' || $dir eq '..'); $tar->read("$ARGV[0]\\$dir", 1); @_ = $tar->list_files(); for my $modinfo (@_) { next unless ($modinfo =~ /modinfo.txt/); $tar->extract_file( $modinfo, "$ARGV[0]\\modinfo.txt"); open(FILE,"$ARGV[0]\\modinfo.txt") || die "D'oh: need a lot of + help here!"; chomp (my @stuff = <FILE>); for my $line (@stuff) { next unless ($line =~ /vx/); $line =~ s/^\s+//; $line =~ /(\w+)\s+(\w+)\s+(\w+)\s+(\d+)\s+(\d+)\s+(\w+)\s+ +\((.+)\)$/; printf "%s, %s,%s,%s,%s,%s,%s,(%s)\n",$dir,$1,$2,$3,$4,$5, +$6,$7; } } }
Can someone please help me out or shed a light on what I need to do in order to extract files from .z files?#! c:/perl/bin/perl.exe use strict; use Compress::Zlib ; my $gz = gzopen("c:\\eee.tar.z", "rb") || die "Cannot open c:\\eee.tar +.z: $gzerrno\n" ; while ($gz->gzreadline($_) > 0) { print ; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Decoding .z and .gz files
by grinder (Bishop) on Mar 26, 2007 at 12:04 UTC | |
by blackadder (Hermit) on Mar 26, 2007 at 12:15 UTC | |
by jettero (Monsignor) on Mar 26, 2007 at 12:34 UTC | |
by blackadder (Hermit) on Mar 26, 2007 at 13:13 UTC | |
by almut (Canon) on Mar 26, 2007 at 14:52 UTC | |
|
Re: Decoding .z and .gz files
by Burak (Chaplain) on Mar 26, 2007 at 13:57 UTC | |
by blackadder (Hermit) on Mar 27, 2007 at 08:42 UTC | |
|
Re: Decoding .z and .gz files
by kyle (Abbot) on Mar 26, 2007 at 14:05 UTC | |
|
Re: Decoding .z and .gz files
by Moron (Curate) on Mar 26, 2007 at 14:52 UTC | |
by blackadder (Hermit) on Mar 28, 2007 at 07:52 UTC |