Can't exclude File or folder with a space

Dec 24, 2009 at 6:58 PM

Hi Cheeso,

    I'm using the exclusion feature and its working perfectly except for when I try to exclude a file or folder with spaces. For example,

I'm trying to do this:

 

using (ZipFile zip = new ZipFile())
{
zip.UpdateSelectedFiles("name != C:\\folder\\File 1", "C:\\Folder", "Folder", true);
}

 

but it seems to be getting confused by the space and throws this exception:

System.ArgumentException: '1'
at Ionic.FileSelector._ParseCriterion(String s)
at Ionic.FileSelector..ctor(String selectionCriteria)
at Ionic.Zip.ZipFile._AddOrUpdateSelectedFiles(String selectionCriteria, String directoryOnDisk, String directoryPathInArchive, Boolean recurseDirectories, Boolean wantUpdate)
at Ionic.Zip.ZipFile.UpdateSelectedFiles(String selectionCriteria, String directoryOnDisk, String directoryPathInArchive, Boolean recurseDirectories)

I tried putting quotes around the path like this: 

using (ZipFile zip = new ZipFile())
{
zip.UpdateSelectedFiles("name != \"C:\\folder\\File 1\"", "C:\\Folder", "Folder", true);
}

but it threw the same exception. Any way around this?

Thanks
Coordinator
Dec 24, 2009 at 7:09 PM

Yes, there's a way around the problem.  To specify a name pattern that includes spaces, use single quotes around the pattern.

This is in the documentation.

Dec 27, 2009 at 4:11 PM

Well thats easy enough. I don't know why i didn't think of that.

thanks Cheeso