Hi,
I'm get a SftpException: No such file; File not found.
when using 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));
}
}
Any ideas as to what's going on here?
Logs:
2011-07-29 11:26:15.991 INFO Sftp(1) Command: SSH_FXP_STAT (13, '/AY_Applicant_Records_20110728_020500_2.txt')
2011-07-29 11:26:16.008 INFO Sftp(1) Response: SSH_FXP_ATTRS (13)
2011-07-29 11:26:16.794 INFO Sftp(1) Command: SSH_FXP_REMOVE (14, '/AY_Applicant_Records_20110728_020500_2.txt')
2011-07-29 11:26:16.810 INFO Sftp(1) Response: SSH_FXP_STATUS (14, 2, 'File not found')
2011-07-29 11:26:16.838 ERROR Sftp(1) Info: Rebex.Net.SftpException: No such file; File not found.
at wWGvS.APnbEo.sxMvMZ(BBdsJfZ , Type )
at wWGvS.APnbEo.BQYzPz(String )
at Rebex.Net.Sftp.DeleteFile(String remotePath)