Not skipping file (General questions)
I can't get the download to skip a file if it does not match the extension (EndsWith).
Stepping through the code shows the skip value is being set to True for matches and false for others. It's just downloading the file anyway.
SFTP version: 3.0.2.14
Here's the code:
// check each file in directory for download
public void sftp1_LoopItemEventDownload(Object sender, WeOnlyDo.Client.SFTP.LoopArgs Args)
{
switch (Args.ItemType)
{
case WeOnlyDo.Client.SFTP.DirItemTypes.Directory:
Args.Skip = true;
ProgressMessage( Skipping directory: + Args.RemoteFile);
break;
case WeOnlyDo.Client.SFTP.DirItemTypes.Symlink:
Args.Skip = true;
ProgressMessage( Skipping symbolic link: + Args.RemoteFile);
break;
case WeOnlyDo.Client.SFTP.DirItemTypes.File:
if (txProc.Filenames.Length != 0)
{
Args.Skip = true;
foreach (string sext in txProc.Filenames)
{
if (Args.LocalFile.EndsWith(sext))
{
Args.Skip = false;
break;
}
}
}
else
{
Args.Skip = false;
}
if (Args.Skip == false)
{
ProgressMessage( Downloading + Args.RemoteFile);
// if file exists in temporary directory - removed it before downloading new version.
if (File.Exists(Args.LocalFile))
File.Delete(Args.LocalFile);
// save file names for later processing
RemoteFileList.Add(Args.RemoteFile);
LocalFileList.Add(Args.LocalFile);
}
break;
default:
Args.Skip = true;
ProgressMessage( Skipping unknown type: + Args.RemoteFile);
break;
}
}
Re: Not skipping file
Ken,
I was able to duplicate this, it was a bug. Official fix on monday.
Kreso
Re: Not skipping file
Excellent. I'll look forward to it.
Ken