How to add an empty directory to a zip archive?

Aug 22, 2011 at 5:05 PM

HELLO,EVERY BODY~

I have to build a empty catagory,and insert file to this catagory;

In win7,it show us a empty catagory,and in xp its a \filename;

I use this dll(1.9.1.5) and it build other catagory without that category;

This dll can't do this? We must use vc++?

My english is not good~ thanks you.wish solution;

Aug 22, 2011 at 5:10 PM

My code :

 string ExistingZipFile = AppDomain.CurrentDomain.BaseDirectory + "temp.zip";
        using (ZipFile zip = ZipFile.Read(ExistingZipFile))
        {           
           
            zip.AddFile(AppDomain.CurrentDomain.BaseDirectory + "1.xml", zip[1].FileName.Replace("0.txt", ""));
            zip.Save();
        }

Aug 22, 2011 at 5:27 PM

<div><img src="http://www.kewayi.cn/FCKeditor/editor/filemanager/connectors/aspx/UploadFiles/image/K008/files.jpg" alt="" /></div>

Coordinator
Aug 22, 2011 at 7:57 PM

I don't know what you mean by "build a catagory".

DotNetZip does zipfiles.  It may be that you want to build a zipfile and manage *directories* within the zip archive.  If so, check the examples - there are many examples showing how to do this.

I don't know what you are trying to do with the call to AddFile.

how about simplifying it?

            var filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "1.xml"); 
            zip.AddFile(filename, "/");
            zip.Save();
        
Aug 23, 2011 at 2:40 AM

Sorry~

" build a empty directory."

Aug 23, 2011 at 2:41 AM

I send that img ;can you see it?

Aug 24, 2011 at 4:20 PM
Cheeso wrote:

I don't know what you mean by "build a catagory".

DotNetZip does zipfiles.  It may be that you want to build a zipfile and manage *directories* within the zip archive.  If so, check the examples - there are many examples showing how to do this.

I don't know what you are trying to do with the call to AddFile.

how about simplifying it?

            var filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "1.xml"); 
            zip.AddFile(filename, "/");
            zip.Save();
        


How can i do it?

Coordinator
Aug 24, 2011 at 5:16 PM

Try: ZipFile.AddDirectoryByName()

It's documented.

 

Aug 26, 2011 at 4:14 PM

Oh~I had try it,but it's not success~

I use winrar had success~

Like this :win rar  a -inul -ed ap/images temp 1.jpg

Thanks vary much too~

Aug 26, 2011 at 4:14 PM
Cheeso wrote:

Try: ZipFile.AddDirectoryByName()

It's documented.

 

 

Oh~I had try it,but it's not success~

I use winrar had success~

Like this :win rar  a -inul -ed ap/images temp 1.jpg

Thanks vary much too~