SevenZipSharp icon indicating copy to clipboard operation
SevenZipSharp copied to clipboard

Trying to add files to an existing ZIP archive creates a NEW archive

Open zipgenius opened this issue 2 years ago • 1 comments

I have the following code that is trying to add files from a FileOpenPicker to an existing zip archive

... var sFiles = await pickerFiles.PickMultipleFilesAsync(); List<string> files = new List<string>(); foreach (StorageFile entry in sFiles) { files.Add(entry.Path); } SevenZipBase.SetLibraryPath(@"C:\Libs\7z.dll"); SevenZipCompressor cp = new SevenZip.SevenZipCompressor(); string fName = @"\C:\Users\matte\desktop\test.zip"; cp.CompressFiles(fName, files.ToArray()); Debug.WriteLine("Check archive NOW!"); ... I'd expected the new files to be added to those already in test.zip but I get a truly new archive holding just the lately added files. It seems that SevenZipCompressor is always open the archive file in Create mode only every time. Am I missing anything?

zipgenius avatar Sep 29 '23 08:09 zipgenius

You'll need to set the compressor's CompressionMode to Append cp.CompressionMode = CompressionMode.Append;

Typically the unit tests are a good place to check for info, given the lack of documentation :)

squid-box avatar Nov 30 '23 21:11 squid-box