是什么导致通过Powershell压缩与手动压缩进行压缩时文件大小和结构的差异

时间:2019-01-17 23:03:58

标签: powershell

当我在PowerShell中压缩目录时,结果与通过右键单击文件夹并选择 Winzip \添加到zip文件手动压缩文件夹的结果不同。

这是我在PowerShell中使用的代码:

Add-Type -Assembly "System.IO.Compression.FileSystem"
[IO.Compression.Zipfile]::CreateFromDirectory("./output/notification_templates", "./output/notification_templates.zip", [System.IO.Compression.CompressionLevel]::Optimal, $false)

我也尝试过

Compress-Archive -Path ./output/notification_templates -DestinationPath ./output/notification_templates.zip

当我将鼠标悬停在通过PowerShell创建的zip文件(文件大小为23 kB)上时,结果如下所示:

Files/Folders in Zip file: 32
jcr_root\.content.xml
jcr_root\test_page29082.html.binary
jcr_root\content\.content.xml
jcr_root\content\boink\.content.xml
jcr_root\content\boink\us\.content.xml
jcr_root\content\boink\us\en\.content.xml
jcr_root\content\boink\us\en\pro\.content.xml
jcr_root\content\boink\us\en\pro\notification_templates\.content.xml
jcr_root\content\boink\us\en\pro\notification_templates\email\.content.xml
Not Shown: 23 files/folders

手动创建时(大小:32 kB):

Files/Folders in Zip file: 61
jcr_root/
jcr_root/.content.xml
jcr_root/content/
jcr_root/content/.content.xml
jcr_root/content/boink/
jcr_root/content/boink/content.xml
jcr_root/content/boink/us/.content.xml
jcr_root/content/boink/us/en/
jcr_root/content/boink/us/en/.content.xml
jcr_root/content/boink/us/en/pro/
jcr_root/content/boink/us/en/pro/.content.xml
jcr_root/content/boink/us/en/pro/notification_templates/
Not Shown: 48 files/folders

如何使用PowerShell复制手动情况?

0 个答案:

没有答案