This project is read-only.

how to remove directory structure from zip file

Jul 2, 2012 at 9:37 PM
Edited Jul 2, 2012 at 9:44 PM


I create a csv file say c:\tmp\myfolder\mydata.csv

when I use zipfile to zip to, it works fine.

when I double click the zip file, I see the first leve is c:\, then next level is tmp, then myfolder, then the file mydata.csv.

What I want in zip is just mydata.csv, so when I double click,  I will see the file mydata.csv only, i.e. without directory info.   How to accomplish this?


I found it, thanks


Jul 10, 2012 at 10:40 AM

you need to write code like mentioned below 

createZipFile.AddFile(fileLocation, string.Empty);

adding string.empty will remove the directory structure 

refer links for more info

May 3, 2013 at 6:49 PM
Edited May 3, 2013 at 6:54 PM
Any support for discarding the directory structure of a zip file not created by DotNetZip, like the behavior of InfoZip's unzip -j flag?

Answered earlier, thank you: