To avoid the methods to interpret the special characters in the path as a mask, use the
RemotePath.EscapeFileMask method to escape the special characters. This is particularly important, when you use variable paths.
For example, if your file is named
filewithstar*.txt, passing such name directly to
Session.GetFiles would download all files with name starting
.txt extension, not only
RemotePath.EscapeFileMask converts the name to unambiguous mask
filewithstar[*].txt, that matches only the
It is an error, when you use path to a file that does not exist with above methods. Though, it is not an error when you use a mask that does not match any file (the directory used with the mask still needs to exist).