How to compress folder without root folder name #247
-
I hope to be able to pass only the path of the root folder, so as to compress all files in the folder (including subfolders) and exclude the name of the root folder. Although I can also manually traverse the file list and generate the corresponding archive path and pass I have tried #106, but not working :( |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi! Anyway, since v4.0.8, I have added another method to |
Beta Was this translation helpful? Give feedback.
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 to7z 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…