Skip to content

How to exclude root directory #106

Answered by rikyoz
jeffreym2-vfi asked this question in Q&A
Discussion options

You must be logged in to vote

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 L"*.*" as a filter for the files to be included in the output archive. Hence, you might want to use L"*" instead so that it will also consider files without extensions.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rikyoz
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