Using edtFTPnetPRO 4.1 and the ExFTPConnection object, I am trying to download a directory that has subdirectories and skip some of those subdirectories based on their names. My call to DownloadMultiple looks like this:
ftp.DownloadMultiple(topLeveDir, txtVSSCopy.Text.Replace(txtURLDescription.Text, ""), new FileFilter(IgnoreFilesGetFirst), true);
and the file filter looks like this:
bool IgnoreFilesGetFirst(FTPFile file)
{
bool getFile = true;
if (file.Dir == true)
{
foreach (string dir in dirsToIgnore)
{
if (file.Name == dir)
{
getFile = false;
break;
}
}
}
else
{
foreach (string ext in extsToIgnore)
{
if (file.Name.ToUpper().EndsWith(ext.ToUpper()))
{
getFile = false;
break;
}
}
}
return getFile;
}
The problem is that, as far as I can tell, file.Dir is never true so that part of the if statement never gets executed. Even if I put "return false;" right after "if (file.Dir == true)" all the subdirectories still download even though (I think) none of them should. Am I doing something wrong, or am I misinterpreting how this is supposed to work, or is there a bug?
Thanks,
Jeff Metzner
DSG