How to exclude root directory #106
-
I'm using compressDirectory to compress the files in a directory. However, I'd like to exclude the root directory from the archive. I'd like the archive to contain: Instead, I'm getting: How would I go about getting the behavior that I want? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi! To achieve the behavior you want, you might use the BitCompressor::compressFiles method which takes the folder path as its first argument. try {
Bit7zLibrary lib{};
BitCompressor compressor{ lib, BitFormat::SevenZip };
compressor.compressFiles( L"path/to/Root", L"out.7z", true, L"*" );
} catch ( const BitException& ex ) {
//std::cerr << ex.what() << std::endl;
} Please note that, by default, it uses |
Beta Was this translation helpful? Give feedback.
Hi!
To achieve the behavior you want, you might use the BitCompressor::compressFiles method which takes the folder path as its first argument.
Please note that, by default, it uses
L"*.*"
as a filter for the files to be included in the output archive. Hence, you might want to useL"*"
instead so that it will also consider files without extensions.