手动zip和powershell zip之间的差异

问题描述 投票:0回答:1

我想使用PowerShell压缩多个文件夹。当我通过PowerShell执行此操作时,其大小约为172 MB,而当我手动对其进行压缩时,其大小约为175 MB,这对我来说是个问题。

我使用的PowerShell脚本:

$source = "C:\fso"
$destination = "C:\fso1\FSO_Backup.zip"
if (Test-Path $destination) {Remove-Item $destination}
Add-Type -Assembly "System.IO.Compression.Filesystem"
[IO.Compression.Zipfile]::CreateFromDirectory($Source, $destination) 

我尝试使用最佳/快速压缩,但没有用。

有人可以帮我吗?我想使用与手动执行时相同的压缩级别进行压缩。

powershell zip
1个回答
-1
投票

嗨,有人知道吗?

我遇到过同样的问题!

在这种情况下,我正在将一个Zip文件上传到使用php解压缩的服务器(joomla安装包)

如果我从Windows压缩(发送到>压缩文件夹),则可以加载并解压缩,很好

如果我使用Powershell压缩

 Compress-Archive -Path $copyto -DestinationPath $copyto".zip"

然后我收到以下错误:

file_put_contents(C:\path\to\Joomla\tmp\install_5dd7d947d6e58\com_package\administrator\): failed to open stream: No such file or directory in C:\path\to\Joomla\libraries\vendor\joomla\filesystem\src\File.php on line 232 

我能看到的唯一区别是有效的是32kb,无效的是28kb。

我曾尝试在最快/最佳和NoCompression之间更改压缩,但它们都失败了。

我想知道是否可能存在编码差异?

© www.soinside.com 2019 - 2024. All rights reserved.