You can also make ZIP files smaller by switching the compression from Deflate to Zstandard. In the one case I tried this, this resulted in a 60% file size decrease [1]. Unfortunately Info-ZIP which provides the unzip command hasn't had a release in 18 years, so it doesn't support this newer compression/decompression method. You have to use 7-Zip instead.
[1] https://github.com/UKGovernmentBEIS/inspect_ai/pull/3145
While not very popular, ECT [1] is (still?) the best solution in this space and has been my go-to tool for this purpose.
> Typically, other archives like .tar.bz2 can be smaller. But those aren’t backwards-compatible!
Is there any point for (new) .bz2 archives in the era of Zstd?
Do any formats using ZIP as the underlying format use ZIP comments for metadata? Unless there's a lot of compressors leaving "Zip file generated by MySuperZipper™" then I imagine any comments left were probably done for a good reason.
APKs need to be zipaligned, I don't see that mentioned.
> This has the side effect of removing empty directories
yeah, this will inevitably break things. excluding those from the directory stripping shouldn't be too hard (TM)
I know you meant well but...
"It deletes empty folders" and "Let me know if this is a problem for you"
NEVER DO THAT. I know you meant well, but the first rule of any program is to NEVER automatically delete something without informing the user. NEVER. Users keep empty folders for structure, reminders, or placeholders because software will dump files into it later when it's run. If it was there when they zipped it up, it should be there when they unzip it. Otherwise they'll check the before and after and it will show some folders missing, create confusion, and the user will run off trying to find out if anything else is missing.
Example: A user zips up a program. Some programs are coded to look for a folder and dump files into it, if the folder is missing the program will fail. I've had that occasionally over the years. Not all programs will recreate a missing folder.
Nice, interesting to see if it helps docx much.
Obviously, the purpose of this tool isn't to preserve 100% compatibility. Things like removing empty directories makes that clear.
But, why would you remove comments? Presumably, if those are there, they were added for a specific reason. And the author acknowledges the space savings are minimal.