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 :
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);
}