We have files that are grouped into different categories, say CatA
..CatD
. Every category has an associated folder which can be configured by the user. For example CatA
goes to C:\Path\To\CatA
, CatB
to C:\Path\To\CatB
and CatC
and CatD
go to C:\Path\To\CatCD
.
Now I want to backup and restore these files in/from a zip file according to a specification like
[CatA]
SomeFile.abc
*.txt
[CatB]
File3.xyz
File4.xyz
.
.
.
The resulting zip file should have a structure like
CatA
SomeFile.abc
aaa.txt
bbb.txt
ccc.txt
CatB
File3.xyz
File4.xyz
.
.
.
I managed this with VCLZip by making multiple calls to the Zip
and UnZip(Selected)
methods per job and a bit of hackery with the Pathname property. However I'd prefer one call to Zip
/UnZip(Selected)
so that VCLZip can calculate the overall progress more accurately and I get a less jumpy progress bar.
I was able to implement this by (ab)using the TVCLUnzip.FilesList.Objects
properties to "transfer" some per file category info into an OnStartZip
handler where I can then manipulate ZipHeader.directory
, but this seems much too complicated and fragile, so I hope there is a more straightforward solution that I just don't see. Any ideas?