This project is read-only.

Create empty directory (unrelated to filesystem)

Aug 25, 2008 at 12:50 PM

I can add files by stream - thats a great thing as I can use this lib using a database as stream input.

What I miss it the ability to add an empty directory - without any access to the real filesystem. Such a directory called A is added automatically if I add a streamed file to this subdirectory like "A\x.txt". But I want to achieve this WITHOUT adding any file - just an empty directory. 

Calling the functions 
always results in 
    String[] filenames = System.IO.Directory.GetFiles(directoryName);and this call throws an exception.

Perhaps another flag in 
   AddOrUpdateActionculd solve this problem: 


   enum AddOrUpdateAction
     AddOnly = 0,

if( action != AddIOAccess )
    String[] filenames = System.IO.Directory.GetFiles(directoryName);



would be the way?
Aug 25, 2008 at 3:28 PM
Hmm, ok.  I understand what you are asking for now.  You were the person that opened up workitem 5671.

I wasn't clear on the scenario.  Still I would like to better understand the "why".
Can you tell me more - like what is the purpose of having an empty directory in the zipfile?

I haven't yet looked at what it would take to make this possible. I'll have to think about your idea with the additional flag in that enum.
Aug 25, 2008 at 3:41 PM
Well, we use a zip-file to export and import data from and to our system.
This system uses a  predefined folder-structure, where all folder have to exist, no matter if files are stored within or not.
All later access to this structure expects the existace of these folder.

So I need the ability to create these folder even if they are empty.
Aug 25, 2008 at 4:56 PM
ok, a simple enough idea.
I will look into it.

Not sure a new flag is the right solution.
I will look.
Aug 26, 2008 at 1:30 AM

I added a method on ZipFile - AddDirectoryByName().

You can find this in the v1.6 preview release, available now.

Let me know if it works for you.


Aug 26, 2008 at 11:08 AM
Thanks a lot, works perfect for me now.