7zip many files from different folders?

Posted by mafutrct on Super User See other posts from Super User or by mafutrct
Published on 2012-09-04T14:48:06Z Indexed on 2012/09/04 15:42 UTC
Read the original article Hit count: 219

Filed under:
|
|

I would like to add a large number of files with different names from different folders to a single 7zip archive using 7za.exe. This should be simple, but it turned out to be a major pain.

I created a file that contains the paths (7za -a @list.txt) but once there are too many (~100) files, it fails. Apparently the content of the argument file is pushed onto the command line buffer, which is far too small (the number of files to add is >1m).

Splitting the process up by adding the files one by one is not feasible due to the way 7za works: When adding the next file, it creates a copy of the archive, adds the file to the copy and finally replaces the original. This is terribly slow once the archive gets to a couple 100MB in size.

So far I am using a combination of the two approaches by adding a dozen files each time in a loop, but it is an unreliable hack and still very slow. Is there a better way to do it?

I tried to use 7zip wrapper DLLs (I'm a C# programmer), but none of them worked reliably and I was repeatedly suggested to just use 7za instead.

© Super User or respective owner

Related posts about archiving

Related posts about 7-zip