title: Check if Remote folder exists - Renci.ssh
body: <p>I want to check if a remote folder exists before listing the files inside it.
  But this code is giving me <code>SftpPathNotFoundException : No such file</code></p>
  
  <p>I know that the folder that is being checked doesn't exist and thats the reason I would like to handle it.</p>
  
  <pre><code>var sftp = new SftpClient(sftpHost, username, password);
  string sftpPath30s = "/home/Vendors/clips/1/4/4";
  
  if (sftp.Exists(sftpPath30s))
     {
       var files30s = sftp.ListDirectory(sftpPath30s); //error here
       if(files30s!=null)
         {
            Console.writeline("code doesn't reach here");
         }
     }
  </code></pre>
  
  <p>This code works fine for other existing folders like "/home/Vendors/clips/1/4/3" etc.</p>