how to remove directory structure from zip file

Jul 2, 2012 at 8:37 PM
Edited Jul 2, 2012 at 8: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 9: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 5:49 PM
Edited May 3, 2013 at 5: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: