Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gunzip problem

Status
Not open for further replies.

mevasquez

Programmer
Aug 26, 2003
75
US
I have a file that I have downloaded using a perl script and the file is in .gz format. The command I am using to gunzip the file is
Code:
system("gunzip -f" . $localfile);  # file name is $file.log.gz
substr($localfile, -3) = "";   #remove the ".gz" from $localfile name


Sometimes this works and sometimes it does not. I don't know why. It was working great for awhile and then all of a sudden I started getting the error.


gunzip: file.log.gz: invalid compressed data--crc error

gunzip: gfile.log.gz: invalid compressed data--length error

What could be causing this problem? I even get this error when doing the command manually.

TIA
Mike V.
 
Hi Mike,
Do you download with FTP. I know using ascii mode with binary files can cause this.
Regards,
Zephan
 
I agree. Those errors look like a file transmission error (CRC failed) and perhaps the file didn't even transfer 100% (length error).
 
Thanks, I will try that with the following script;
Code:
use Net::FTP;
my($filetype = "binary");
ftp = Net::FTP->new($hostname, Timeout => 30, debug => 1)
         or die ("Can't connect: $@\n");
$ftp->login($username, $passwd)
  or die "Could not login!";
$ftp->$filetype;
 
Opps, the corrected script.

Code:
use Net::FTP;
[COLOR=red]my($filetype) = "binary"; [/color]
ftp = Net::FTP->new($hostname, Timeout => 30, debug => 1)
         or die ("Can't connect: $@\n");
$ftp->login($username, $passwd)
  or die "Could not login!";
$ftp->$filetype;

This worked.

Thanks.

Mike V.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top