Closed EruditePig closed 6 years ago
Unfortunately that compressFiles
method doesn't retain the directory structure by design.
Actually, I don't like how bit7z handles files, to be honest, and I planned to improve it as soon as I can, probably rewriting it from scratch.
Anyway, a method which retains the directory structure is the following:
void BitCompressor::compressFiles( const wstring& in_dir, const wstring& out_archive,
const wstring& filter = L"*", bool recursive = true ) const;
As you can see, it doesn't have the same flexibility of your requirements: first of all, you have to specify the directory in_dir
containing the files to be compressed (instead of a vector of file paths, as in the other compressFiles
method); then, in order to compress only the files you want, you must specify a file filter, a string which can include wildcards (e.g. simple*.*
will select all files starting with the string simple
). Moreover, the archive will contain a folder with the name of the directory in_dir
, hence it will have the structure:
dir_name
|--1\\file1.jpg
|--file2.jpg
I don't know if you can adapt it to your requirements. I hope to improve the flexibility of the API in future!
Hi,
I noticed that API last night, and it doesn't fit my requirements.
I am coding a program to archive the files for the result files of a structure analysis software. It has a lot of filter that maybe only regex can handle. So i give up that API.
I am looking forward to your improvement!
Thank you!
I used a zip.h and zip.cpp before. In its API, I can custom the directory system in the zip file.Here is its sample code.
and I can get the directory like this in the zip file. -1 |--zmsimple.hpp -znsimple.txt
If i compress file in the bit7z like this
the file1.jpg and the file2.pdf just lay in the zip file, I cann't specify the directory system in the zip file.
Thank you!