Re: extract members from tar.gz files in Windows
At 02:25 PM 11/14/2006 -0800, Dan Jablonsky wrote: >So, I guess I don't know what is the equivalent module >for tar.gz that would do the same thing as >Archive::Zip for zip ... (I tried Archive::Extract but >I got nowhere). Quick and dirty way: @members = `tar -ztf $file`; -- REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=-- "...ne cede malis" 0100 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: extract memeber of zip archive to directory
- Original Message - From: "Dan Jablonsky" <[EMAIL PROTECTED]> To: Sent: Wednesday, November 15, 2006 5:37 AM Subject: extract memeber of zip archive to directory > Hi all, > would anybody tell me how to extract a zip archive > member to a certain directory? > > I used the code below; however I can't extract the > member in other place than the present working > directory (namely, I am checking if the member has a > certain name and if true I extract it - this always > happens in the same directory where the archive > resides): > > my $zip = Archive::Zip->new(); > $zip->read($_) == 0 or die "Can't read ZIP file"; > foreach my $member ($zip->members) > { > my $zip_member = $member->fileName; > if($zip_member =~/$search_pattern/) > { > #print "\nI FOUND 1 file!\n"; > #must extract the found file from the archive Not sure, but try: my $extractedName = "$mydir\\$zip_member"; $zip->extractMember($member, $extractedName); Cheers, Rob ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: extract members from tar.gz files in Windows
- Original Message - From: "Dan Jablonsky" <[EMAIL PROTECTED]> . . > > So, I guess I don't know what is the equivalent module > for tar.gz that would do the same thing as > Archive::Zip for zip ... (I tried Archive::Extract but > I got nowhere). > You'll need Archive::Tar and Compress::Zlib - and you'll already have both of those modules if you're running ActiveState perl. See 'perldoc Archive::Tar'. Cheers, Rob ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
extract members from tar.gz files in Windows
Hi all, new problem encountered - I am trying to write a short script that will search a pattern in file names that are either within a directory or inside a zip archive in some directory. I managed to get the results I needed while the files were within zip archives (or unarchived) however now I see some of the archives are tar.gz and the code doing the trick with the zip archives obviously are not working when applied to a tar.gz file. so the code below i swhat I use for zip archives: use Archive::Zip; use Archive::Extract; use File::Find; #start searching &File::Find::find(sub{ if($_ =~/\.zip/) {#if you find a zip file - open and read my $zip = Archive::Zip->new(); $zip->read($_) == 0 or die "Can't read ZIP file"; foreach my $member ($zip->members) { my $zip_member = $member->fileName; if($zip_member =~/$search_pattern/) { print "\nI FOUND 1 file!\n"; #must extract this file from the archive $zip->extractMember($member, "C:/somepath"); } } } elsif($_ =~/\.tar\.gz/) {#if you find a tar.gz file - open and read ??? #build an Archive::Extract object my $ae = Archive::Extract->new(archive => $_); my @files = $ae->files; ? i don't know if I can go on here ... else { if($_ =~m/$search_pattern/) { print "\nI FOUND 1 file!\n"; #move this file to some directory } } }, $search_directory); So, I guess I don't know what is the equivalent module for tar.gz that would do the same thing as Archive::Zip for zip ... (I tried Archive::Extract but I got nowhere). Any help would be appreciated, Thanks, Dan Yahoo! Music Unlimited Access over 1 million songs. http://music.yahoo.com/unlimited ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
extract memeber of zip archive to directory
Hi all, would anybody tell me how to extract a zip archive member to a certain directory? I used the code below; however I can't extract the member in other place than the present working directory (namely, I am checking if the member has a certain name and if true I extract it - this always happens in the same directory where the archive resides): my $zip = Archive::Zip->new(); $zip->read($_) == 0 or die "Can't read ZIP file"; foreach my $member ($zip->members) { my $zip_member = $member->fileName; if($zip_member =~/$search_pattern/) { #print "\nI FOUND 1 file!\n"; #must extract the found file from the archive $zip->extractMemberWithoutPaths($member); } } I tried $zip->extractMemberWithoutPaths($member, $mydir); but it did not work; somehow I'm not able to find what's missing here ... Thanks a bunch, Dan Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail beta. http://new.mail.yahoo.com ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs