我尝试使用Perl Archive模块解压一个受密码保护的zip文件。但结束语是一个错误
错误:
inflate error data error at C:/Perl64/site/lib/Archive/Zip/Archive.pm line 367.
谁能帮我找到一个解决方案,解压一个受密码保护的zip文件(WINRAR用来用密码压缩文件)。
请找到我使用的代码:
my $file = "D:\\Public\\Sample-Programs\\tempzip\\TESTFILE.zip";
my $password = "aaa";
my $zip = Archive::Zip->new($file) or die "can't unzip";
foreach my $member_name ($zip->memberNames) {
my $member = $zip->memberNamed($member_name);
next if $member->isDirectory;
$member->password($password);
my $contents = $zip->contents($member) or die "error accessing $member_name";
print("contents = $contents");
}发布于 2016-11-24 22:48:45
在另一种方式上有一个解决方案,我想它可能是有帮助的:
未测试过使用winzip refered from
my $Prog = $ENV{"ProgramFiles"}.'\\WinZip\\WINZIP32.exe';
my $Password = 'Secret Password';
my $ZIP = 'filename.zip';
my $Path = 'c:\\my\\folder';
system("$Prog -e -s\"$Password\" \"$Zip\" \"$Path\"");使用7zip进行测试:
my $file = "test.zip";
my $password = "secret";
my $Prog = "\"c:\\Program Files\\7-Zip\\7zG.exe\"";
system("$Prog e -p$password -y $file");https://stackoverflow.com/questions/40787868
复制相似问题