Can't exclude the child file

Oct 12, 2009 at 2:22 AM

Hi Cheeso

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

if my code is as following:

zip.AddSelectedFiles(@"name != .\bin\help.chm and name != readme.txt", @"d:\test01", true);

the "readme.txt" is excluded successfully, but the "D:\test01\bin\help.chm" is added in zip archive.

 

if my code is as following:

zip.AddSelectedFiles(@"name != help.chm and name != readme.txt", @"d:\test01", true);

the "readme.txt" and "D:\test01\bin\help.chm" are excluded successfully. And the "D:\test01\help.chm" is excluded too, i want to add the "D:\test01\help.chm" to zip archive.

 

Doesn't the filename not include relative path when i write the selector criteria??

 

 

Oct 12, 2009 at 2:26 AM

if there is a empty directory under the "D:\test01", the empty directory is not added in the zip archive.

 

Coordinator
Oct 12, 2009 at 9:42 AM

To answer your question about the relative paths. . .

I think the full path is included in the name, when you select in a directory specified with an absolute pathname, like d:\test01 .  Maybe the criteria you want is:

"name != *\bin\help.chm and name != readme.txt"

or you could specify the full path, as with this:

"name != d:\test01\bin\help.chm   and   name != readme.txt"

In answer to your second post - about the empty directory - I think you are correct.  It is a file selector, so the way I coded it, it does not select directories. 

 

 

Oct 13, 2009 at 1:10 AM

thanks,

I get all empty directories first, add them to the zip archive through the AddDirectoryByName.