Skip to content

How to compress folder without root folder name #247

Answered by rikyoz
Polar-Pumpkin asked this question in Q&A
Discussion options

You must be logged in to vote

Hi!
Yeah, prior to v4.0.8, #106 was the only way to compress a folder without the root.
The reason it doesn't work in your case is probably because it only works if the directory path is an absolute path, otherwise it still includes the root; this is done to emulate the behaviour of the 7-Zip CLI under the same settings, as compressFiles( L"path\\to\\root", L"out.7z", true, L"*" ) is basically equivalent to 7z a out.7z path\to\root\*.
I don't know why I didn't mention this detail in that discussion, sorry.

Anyway, since v4.0.8, I have added another method to BitFileCompressor: compressDirectoryContents.
This does exactly what you want, it compresses the contents of the folder, without inc…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Polar-Pumpkin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants