I'm get a SftpException: No such file; File not found.
when using Rebex sftp's Sftp.DeleteFile(string filename
) which is especially odd because I'm first checking that the file exists.
Here's the relevant sample code:
foreach (var file in fileList)
{
if(ftp.Connection.FileExists(file.Name))
{
try
{
ftp.Connection.DeleteFile(file.Name);
}
catch (SftpException ex)
{
Log.Error("Deletion failed.", ex);
}
}
else
{
Log.Debug(string.Format("'{0}' not found.", file.Name));
}
}
Rebex's online docs can be found here for those not familiar with the library.
Any ideas as to what's going on here?