+1 vote
by (620 points)

Since the characters '?' and '*' are valid FTP filenames, how do I deal with that in IFtp.GetItems.
For example, I have a folder named "?" at the root, and when I try to enumerate it's contents, I will call:
ftp.GetItems("/?", TraversalMode.Recursive)
but this is giving me recursive contents of the root folder "/" instead.
How do I specify a literal "?" as the folder name? Any way to escape it?
Thanks,

1 Answer

0 votes
by (73.6k points)
selected by
 
Best answer

There is no way to escape wildcards at the moment.

However, your example can be implemented simply by using FileSet class with basePath set to "/?" (basePath does not evaluate any wildcards). It can be done like this:

var fset = new FileSet("/?", "*", TraversalMode.Recursive);
ftp.GetItems(fset);
by (620 points)
That works. Thank you very much!
...