Zipping files into the root

Mar 8, 2012 at 4:14 PM

I am creating a zip and it basically zips the files in the same folder structure for which they came. How can I eliminate that? I just want the files in a zip with no folders??

Mar 12, 2012 at 1:00 PM
Edited Mar 12, 2012 at 1:21 PM

I am looking for the same thing. I am using the AddSelectedFiles functionality with a search criteria, and I can't figure out how to omit the directories and just get the files.

I will keep looking, and watching this thread as well.


The documentation states that passing "" will place files in the root of the zip folder, without the sub-directories but, this is not working in my case. If I pass an empty string ("") I still get the sub-directories. The documentation is here:

In the treeview, expand Reference >> Ionic.Zip Namespace >> ZipFIle Class >> AddSelectedFiles Method, and look at the last overload.

Sep 26, 2012 at 5:43 PM



you can achieve it in the follwoing way 

  ZipEntry e = ZipFile.AddFile(filename,"Specify the File name you want in ZipFolder(you can aviod multiple folder creation)");

 ZipFile.Save("Specify the Path you want to Save");