What's causing the difference in file size and structure when compressing through powershell vs compressing manually

Viewed 110

When I compress a directory in PowerShell, the result is different than when I compress the folder manually by right clicking on the folder and selecting Winzip → Add to zip file.

Here's the code I am using in 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)

I've also tried

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

The result looks like this when I hover over the zip file created through PowerShell (file size 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

When created manually (size: 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

How do I replicate the manual case with PowerShell?

0 Answers
Related