What's causing the difference in file size and structure when compressing through powershell vs compressing...
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_roottest_page29082.html.binary
jcr_rootcontent.content.xml
jcr_rootcontentboink.content.xml
jcr_rootcontentboinkus.content.xml
jcr_rootcontentboinkusen.content.xml
jcr_rootcontentboinkusenpro.content.xml
jcr_rootcontentboinkusenpronotification_templates.content.xml
jcr_rootcontentboinkusenpronotification_templatesemail.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?
powershell
New contributor
foo bar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
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_roottest_page29082.html.binary
jcr_rootcontent.content.xml
jcr_rootcontentboink.content.xml
jcr_rootcontentboinkus.content.xml
jcr_rootcontentboinkusen.content.xml
jcr_rootcontentboinkusenpro.content.xml
jcr_rootcontentboinkusenpronotification_templates.content.xml
jcr_rootcontentboinkusenpronotification_templatesemail.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?
powershell
New contributor
foo bar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2
Winzip is not the same as io.compression.zipfile. I guess they use different defaults for compression levels. etc. I note here docs.microsoft.com/en-us/powershell/module/… that the default for-CompressionLevelisOptimal. Maybe tryFastestinstead and see if you get the same result.
– Nick.McDermaid
2 days ago
1
Compression level is the first thing I'd look at, as Nick already mentioned. On top of that it looks like Winzip creates explicit entries for each directory while the .Net methods don't.
– Ansgar Wiechers
yesterday
add a comment |
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_roottest_page29082.html.binary
jcr_rootcontent.content.xml
jcr_rootcontentboink.content.xml
jcr_rootcontentboinkus.content.xml
jcr_rootcontentboinkusen.content.xml
jcr_rootcontentboinkusenpro.content.xml
jcr_rootcontentboinkusenpronotification_templates.content.xml
jcr_rootcontentboinkusenpronotification_templatesemail.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?
powershell
New contributor
foo bar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
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_roottest_page29082.html.binary
jcr_rootcontent.content.xml
jcr_rootcontentboink.content.xml
jcr_rootcontentboinkus.content.xml
jcr_rootcontentboinkusen.content.xml
jcr_rootcontentboinkusenpro.content.xml
jcr_rootcontentboinkusenpronotification_templates.content.xml
jcr_rootcontentboinkusenpronotification_templatesemail.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?
powershell
powershell
New contributor
foo bar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
foo bar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited yesterday
Ansgar Wiechers
141k13126185
141k13126185
New contributor
foo bar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 2 days ago
foo barfoo bar
111
111
New contributor
foo bar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
foo bar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
foo bar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2
Winzip is not the same as io.compression.zipfile. I guess they use different defaults for compression levels. etc. I note here docs.microsoft.com/en-us/powershell/module/… that the default for-CompressionLevelisOptimal. Maybe tryFastestinstead and see if you get the same result.
– Nick.McDermaid
2 days ago
1
Compression level is the first thing I'd look at, as Nick already mentioned. On top of that it looks like Winzip creates explicit entries for each directory while the .Net methods don't.
– Ansgar Wiechers
yesterday
add a comment |
2
Winzip is not the same as io.compression.zipfile. I guess they use different defaults for compression levels. etc. I note here docs.microsoft.com/en-us/powershell/module/… that the default for-CompressionLevelisOptimal. Maybe tryFastestinstead and see if you get the same result.
– Nick.McDermaid
2 days ago
1
Compression level is the first thing I'd look at, as Nick already mentioned. On top of that it looks like Winzip creates explicit entries for each directory while the .Net methods don't.
– Ansgar Wiechers
yesterday
2
2
Winzip is not the same as io.compression.zipfile. I guess they use different defaults for compression levels. etc. I note here docs.microsoft.com/en-us/powershell/module/… that the default for
-CompressionLevel is Optimal. Maybe try Fastest instead and see if you get the same result.– Nick.McDermaid
2 days ago
Winzip is not the same as io.compression.zipfile. I guess they use different defaults for compression levels. etc. I note here docs.microsoft.com/en-us/powershell/module/… that the default for
-CompressionLevel is Optimal. Maybe try Fastest instead and see if you get the same result.– Nick.McDermaid
2 days ago
1
1
Compression level is the first thing I'd look at, as Nick already mentioned. On top of that it looks like Winzip creates explicit entries for each directory while the .Net methods don't.
– Ansgar Wiechers
yesterday
Compression level is the first thing I'd look at, as Nick already mentioned. On top of that it looks like Winzip creates explicit entries for each directory while the .Net methods don't.
– Ansgar Wiechers
yesterday
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
foo bar is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54245548%2fwhats-causing-the-difference-in-file-size-and-structure-when-compressing-throug%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
foo bar is a new contributor. Be nice, and check out our Code of Conduct.
foo bar is a new contributor. Be nice, and check out our Code of Conduct.
foo bar is a new contributor. Be nice, and check out our Code of Conduct.
foo bar is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54245548%2fwhats-causing-the-difference-in-file-size-and-structure-when-compressing-throug%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Winzip is not the same as io.compression.zipfile. I guess they use different defaults for compression levels. etc. I note here docs.microsoft.com/en-us/powershell/module/… that the default for
-CompressionLevelisOptimal. Maybe tryFastestinstead and see if you get the same result.– Nick.McDermaid
2 days ago
1
Compression level is the first thing I'd look at, as Nick already mentioned. On top of that it looks like Winzip creates explicit entries for each directory while the .Net methods don't.
– Ansgar Wiechers
yesterday