I have a bit of an odd problem with uncompressing a .gz file. If I uncompress an Office file that has been gzipped then the Office file becomes corrupt. This is true with the old office format (doc,xls) and the new format (docx,xlsx).
If however I uncompress any other file (eg: avi,txt,bmp) that has been gzipped then there are no problems. I've tried using Archive::Extract and IO::Uncompress::Gunzip and I get the same results with both.
Here is the code I'm using for Archive::Extract:Here is the code I'm using for IO::Uncompress::Gunzip:use strict; use warnings; use Archive::Extract; my $file = "Testing.xls.gz"; my $ae = Archive::Extract->new(archive => $file); unless(my $ok = $ae->extract){ print "There was an error: $ae->error"; }
Any help with this will be greatly appreciated.use strict; use warnings; use IO::Uncompress::Gunzip qw(gunzip $GunzipError); my $file = "Testing.xls.gz"; my $out = "Testing.xls"; my $status = gunzip $file => $out or die "gunzip failed: $GunzipError\ +n";
In reply to Office file becomes corrupt once extracted from gz by tone
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |