Unzipping only 1 directory from zip file

Jan 6, 2010 at 6:07 PM

I am zipping a directory that contains many subdirectories..I want to unzip only 1 of the subdirectories when

the time comes

This is the way Im doing it right now..

 

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

foreach

</font></font><font size="2" color="#0000ff">

 

</font>

(ZipEntry Ext1 in unzip1)

{

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

      if

</font></font><font size="2" color="#0000ff">

 

</font>

(Ext1.FileName.Length > 11)

         {

             if (Ext1.FileName.Substring(0, 11) == "TOA/Shadow/")

                  Ext1.Extract(DI.FullName);

        }

}

This works, but wondering if theres a better way....

 

Coordinator
Jan 6, 2010 at 7:40 PM

I think what you're doing is a string match on the FileName, to see if the entry is in the desired directory.

That's the only way to do it in zip files.  Zip files do not treat directories as "container" objects.