Is there anyway in Dot Net Zip that I can use to list all the names of files in a specific directory? For example, i can specify Directory1 and get File3 and File4 etc
ZipFile
-------
File1
File2
Directory1
File3
File4
Directory2
File5
File6
ZipFile object has only Entries, Entries Sorted, and Entries File Names…
Anyone?, Cheeso? 🙂
No, and yes. There is no EntriesInDirectory collection. However, it’s a simple matter of string comparison to select entries that “belong” in a particular directory.
In LINQ it looks like this:
In a for loop, it looks like this:
EDIT
You may have to do conversions for case sensitivity. On Windows, case is not meaningful in file names.
Further Explanation: the zip format doesn’t treat a directory entry in the zip file as a container. There is no container relationship between directory entries and file entries. The only way to tell if a file entry “belongs in” a particular directory is to examine the full name of the file entry. If the name of the entry starts with the name of the directory in question, then the entry is “in” the directory.