I am downloading files from FTP using WinSCP .NET library.
My code is
session.ExecutablePath = _appSettings["ApplicationFolderPath"] + "WinSCP.exe";
session.Open(sessionOptions);
var obj = session.ListDirectory(_appSettings["SFTP_IncomingFileFolder"]);
if (obj != null && obj.Files != null)
{
foreach (RemoteFileInfo fileOrDo in obj.Files)
{
if (fileOrDo.Name == "." || fileOrDo.Name == ".." || fileOrDo.FileType == 'd' || fileOrDo.FileType == 'D')
{
continue;
}
// here I want's to check whether file is not in use before calling session.GetFiles(...,...).Check();
}
}
What I want's is to check file is not in use on FTP location before downloading it. Any idea what interface I should use.