Archived Forum Post

Index of archived forum posts

Question:

How to change the directory where the Zip is created?

Oct 23 '12 at 15:40

I'm trying the CHILKAT ZIP but I have a question? How can I change the directory where the compressed file will be created?


Answer

If creating a completely new zip archive, then pass the absolute or relative directory path of the zip archive that is to be created to the NewZip method:

zip.NewZip("c:/temp/abc.zip");

If opening an existing zip archive, adding files, and re-writing, then update the zip.FileName to the path of the .zip that is to be written prior to calling WriteZip. (This part of the API was poorly designed more than 10 years ago. It would've been better to simply pass the file path to the WriteZip method.)