Compress a directory except some child files and child directories

Oct 10, 2009 at 9:22 AM

Hi Cheeso

        i want to compress a directory to zip file except some child files and directories,  how can i do?

        for example,  the directory is "D:\test01", there are many child files and directories under it, i want to compress "D:\test01" except the child directory "D:\test01\bin" and child files "D:\test01\readme.txt", "D:\test01\help.chm".


Oct 10, 2009 at 2:15 PM

You have to try the AddSelectedFiles() or the Ionic.FileSelector class .

You can specify the selection criteria like this:   "name != .\bin\*.* and name != .\readme.txt and name != .\help.chm"

ZipFile.AddSelectedFiles(criteria, "d:\\test01", true);



Oct 11, 2009 at 4:48 AM

Cheeso, the AddSelectedFiles() can't be used in this situation, because the excluding child files and directories can't be specified the selection criteria, they are specified by users.


Oct 11, 2009 at 4:58 AM

I don't understand.  Can you explain in more detail why you think that AddSelectedFiles cannot be used? 


Oct 11, 2009 at 5:32 AM

Cheeso,  i am wrong,

AddSelectedFiles can be used in my program.

Thank you very much!