我尝试使用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");
}
答案 0 :(得分:1)
另一种方式有解决方案,我猜它可能有用:
未经测试使用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");