how to omit directory structure in the create zip file?

Coordinator
Nov 26, 2008 at 3:16 AM
Hello,
I just downloaded your DotNetZip library and I'm trying to zip mp3 files for users to download. When I call method "AddFile" and the zip file is created, it includes the whole directory structure. Is there a way that I can only add the specific files without saving the whole directory structure?

Thank you,
-Alex
Coordinator
Nov 26, 2008 at 3:30 AM
Hey Alex!
Glad you're finding DotNetZip useful. 

The question you asked is a FAQ. Here are 3 examples, in each case the code statement adds a file to an archive.

The directory of the file in the archive will reflect the directory of the file on the disk:
  zip.AddFile(@"c:\Directory\subdir\file.zzz");

The file will be added into the top-level directory in the archive:
  zip.AddFile(@"c:\Directory\subdir\file.zzz", "");

The file will be added into the directory "files" in the archive:
  zip.AddFile(@"c:\Directory\subdir\file.zzz", "files");