0 votes
by (1.2k points)

I want to Upload the folder "C:\MyFolder" and all files and subfolders via FTP.

Except one single folder "C:\MyFolder\Ignore" with all its content.

When using a FileSet I tried serveral exclude pattern and none matched.

var fs = new FileSet(@"C:\MyFolder\");
fs.Include(@"*");

// This didn't work:
fs.Exclude(@"**/MyFolder/Ignore/**");

// This didn't work, too:
fs.Exclude(@"C:\MyFolder\Ignore");

My questions:

  • What is the correct syntax to exclude a full subtree?
  • Are exclude patterns case-sensitive? If yes, how to make them case-insensitive?
Applies to: Rebex FTP/SSL

1 Answer

+1 vote
by (58.9k points)
selected by
 
Best answer

A] Exclude and Include methods do not support full paths. They only accept paths and patterns relative to the basePath of the FileSet (in your case, relative to @C:\MyFolder"). So in your case to Exclude the "C:\MyFolder\Ignore" folder completely, just write:

var fs = new FileSet(@"C:\MyFolder");
fs.Include("*");

fs.Exclude("Ignore");

B] the patterns follow the case sensitivity of the OS that your program runs on. So if you are on Windows systems, the patterns are not case-sensitive, whereas on Linux, Unix, OSX, iOS, etc the patterns are case sensitive.

by (1.2k points)
Awesome, thanks a lot, Tomas!
by (1.2k points)
If I have another folder, say "Ignore-Dont", that starts the same as "Ignore", it still would be included, right?
by (58.9k points)
Yes, it will be included.
by (58.9k points)
Thank you for your feedback. I have improved the xml doc of the FileSet.Include and Exclude method.  With the next release of our web, we'll also impove the features page at https://www.rebex.net/ftp-ssl.net/features/multiple-files-operations.aspx#fileset
...