sftp client 'Exists' method returns true always

Apr 14, 2014 at 9:06 AM
I am using SSH.NET library which is working perfectly on LINUX SFTP server. But I used the same code to check on Windows SFTP but it is not working as expected.

Issue is that when I check whether Directory or File exists or not using sftpClient.Exist(Path) method, it always returns true even that file or directory does not exist.

Below is the code I am using :
this.sftpClient = new SftpClient([HOST], [PORT], [USER_NAME], [PASSWORD]);
this.sftpClient.OperationTimeout = new TimeSpan(0, 0, 0, 10);
this.sftpClient.ConnectionInfo.Timeout = new TimeSpan(0, 0, 10, 0);

var pathToCheck = [PATH];

// Exists always return true
if (!this.sftpClient.Exists(pathToCheck))
May 7, 2014 at 8:03 PM
Marked as answer by drieseng on 5/7/2014 at 1:03 PM