Comments: ** Comment from web user: mmoufakkir2 **
my changing the beloow method in sftpclient.cs from
public bool Exists(string path)
{
if (path.IsNullOrWhiteSpace())
throw new ArgumentException("path");
if (this._sftpSession == null)
throw new SshConnectionException("Client not connected.");
var fullPath = this._sftpSession.GetFullRemotePath(path);
if (this._sftpSession.RequestRealPath(fullPath, true) == null)
{
return false;
}
else
{
return true;
}
}
to
public bool Exists(string path)
{
if (path.IsNullOrWhiteSpace())
throw new ArgumentException("path");
if (this._sftpSession == null)
throw new SshConnectionException("Client not connected.");
var fullPath = this._sftpSession.GetCanonicalPath(path);
// Try to open as a file
var handle = this._sftpSession.RequestOpen(fullPath, Flags.Read, true);
if (handle == null)
{
handle = this._sftpSession.RequestOpenDir(fullPath, true);
}
if (handle == null)
{
return false;
}
else
{
this._sftpSession.RequestClose(handle);
return true;
}
}
the new code was taking form a old version of sshnet library.
good luck to all