Quantcast
Channel: SSH.NET Library
Viewing all articles
Browse latest Browse all 2955

New Post: sftp client 'Exists' method returns true always

$
0
0
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);
this.ConnectToServer();

var pathToCheck = [PATH];

// Exists always return true
if (!this.sftpClient.Exists(pathToCheck))
{
    this.sftpClient.CreateDirectory(pathToCheck);
}

Viewing all articles
Browse latest Browse all 2955

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>