bit7z icon indicating copy to clipboard operation
bit7z copied to clipboard

Generate a new folder in the compressed file,and compress the file to the new folder.

Open zhenhxiaobin0210 opened this issue 5 years ago • 3 comments

question: (1) Generate a new folder in the compressed file;

(2) Compress the file to the (1) folder.

zhenhxiaobin0210 avatar Apr 09 '20 08:04 zhenhxiaobin0210

Can you give me some examples, thank you

zhenhxiaobin0210 avatar Apr 09 '20 08:04 zhenhxiaobin0210

Hi! Sorry for the late reply!

question: (1) Generate a new folder in the compressed file;

Generating an empty folder inside a compressed file is not possible, at the moment.

(2) Compress the file to the (1) folder.

However, you can achieve your goal by using the method

void BitCompressor::compress( const map< wstring, wstring >& in_paths, const wstring& out_file ) const;

which allows to compress files while giving them a new alias. In particular, you could use it as follows:

std::map< std::wstring, std::wstring > file_map = {
    { L"path/to/file.ext", L"new_folder/file.ext" }
};
compressor.compress( file_map, out_file );

In this way, the compressed file will appear inside a folder called new_folder in the output archive.

rikyoz avatar May 04 '20 20:05 rikyoz

Thank you very much for your reply! Now I want to update some of the files in the compressed file. If there is already a“ xx.dat ”How do I overwrite this file. If I use this function“ compressor.setUpdateMode (true) "will generate two files with the same name in the compressed file“ xx.dat " But actually I want to overwrite the original file with the same name. thank you!

zhenhxiaobin0210 avatar Jun 17 '20 11:06 zhenhxiaobin0210