Hi everybody, I guess I still have a problem with my reading of tar.gz files. Everything work juuuust great with the code below until I happened to hit a corrupted file and I can't see a way to jump over it. My point is that in a list with hundreds of tar.gz files all of them are valid, less one (of small size which also happens to be quite at the top of the list) which makes the script to go kaboom.
&File::Find::find( sub { #traversing a file structure if($_ =~/\.tar\.gz/) { #if you found a tar.gz file - open and read #build an Archive::Tar object my $tar = Archive::Tar->new($_); my @files = $tar->list_files() or die "Can't read TAR.GZ file!\n"; #go thru the array and look for the pattern foreach my $tar_member (@files) { if($tar_member =~/$search_pattern/) { print "\nI FOUND 1 file!\n"; #must extract the found file from the archive $tar->extract_file($tar_member, $some_path); } } } }, $search_directory); So, the problem is that my script gets to the line with my $tar = Archive::Tar->new($_); but starts to print error messages like: Couldn't read chunk at offset unknown at C:\path\to my\script.pl ... Illegal octal digit '9' ignored at C:/Perl/site/lib/Archive/Tar/File.pm line 206 and so on ... Is there a way to verify the validity of the Tar (or the file) BEFORE I call the new for the Archive::Tar object and in case the file is not valid allow to skip it? By the way, when I try to open the said tar.gz, WinZip reports :Invalid Archive Directory! 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