Batch operation such as the GetFiles method is a very complex function and in the present form it needs some features to be supported by the server. For example to determine whether a specified item (file/directory) exists on the remote host and which properties has.
Unfortunately your server doesn't support MLST nor MDTM nor SIZE command. We are sorry, but you cannot use the GetFiles method against your FTP server.
Still, you can write your simple version of GetFiles method as follows:
private static void GetFiles(
Ftp client, string sourceDirectory, string targetDirectory, string fileMask)
{
fileMask = Regex.Escape(fileMask).Replace("\\?", ".").Replace("\\*", ".*");
Regex filter = new Regex(fileMask);
FtpList list = client.GetList(sourceDirectory);
foreach (FtpItem item in list)
{
if (!item.IsFile)
continue;
string name = Path.GetFileName(item.Name);
if (!filter.IsMatch(name))
continue;
string source = string.Format("{0}/{1}", sourceDirectory, name);
string target = Path.Combine(targetDirectory, name);
client.GetFile(source, target);
}
}
And use it like this:
GetFiles("/home/TESTACC/DOWNLOAD", "C:\\", "VRCLNT.*");
If you need a hint, how to write recursive transfers, please don't hesitate to ask.