title: Unable to Upload/Download files using SCP from a Cisco switch configured as SSH server
body: <p>I need to be able to upload and download (configuration) files using SCP from and to a Cisco Switch that is configured to act as an SSH server. This needs to be coded in C#</p>
  
  <p>I started by using the SharpSSH library (Tamir.SharpSSH) wich is pretty straight forward.</p>
  
  <pre><code>Scp scp = null;
      try
      {
          scp = new Scp(Switch.Ip, Switch.User, Switch.Password);
          scp.Timeout = Switch.Timeout;
          scp.Connect();
          if (scp.Connected)
          {
              scp.Get(@"flash:/scp/test.txt", @"C:\Users\Administrator\Desktop");
              scp.Close();
          }
      }
      catch (Exception)
      {}
  </code></pre>
  
  <p>This code should download the "test.txt" file from the remote SSH server to the local desktop. But everytime I try to exectue this code I get the error "scp: "flash:/scp/test.txt": No such file or directory" even though this is clearly a directory and file on the server as <a href="http://i.stack.imgur.com/r2t3D.png" rel="nofollow">shown</a>.</p>
  
  <p>After this I gave up on sharpSSH and tried the SSH.NET (Renci.SshNet) library hoping this would give me better results. But no luck. using the code below</p>
  
  <pre><code>ScpClient scp = null;
      try
      {
          scp = new ScpClient(Switch.Ip, Switch.User, Switch.Password);
          scp.Connect();
          if (scp.IsConnected)
          {
              scp.Download(@"flash:/scp/test.txt", new DirectoryInfo(@"C:\Users\Administrator\Desktop"));
              scp.Disconnect();
          }
      }
      catch (Exception e)
      {}
  </code></pre>
  
  <p>But this gave me the error "-p -r -d options not supported".
  at this moment I just don't know what to try anymore.
  I also tested the SSH.NET library localy with a setup Bitvise SSH server where I was able to succesfully upload and download files. 
  I'm clueless what could be the problem.</p>
  
  <p>Edit: The local code I tested that worked with the SSH.NET library and the Bitvise SSH server. Bitvise root directory is "/" where I made a map scp with a text.txt file inside. So to be clear the flash:/ directory is not applicable here as this only exists on the cisco switch and I did not recreate this on the Bitvise server.</p>
  
  <pre><code>       if (scp.IsConnected)
          {
              System.Console.WriteLine("SCP CONNECTED");
  
              if (type == "download")
              {
                  scp.Download(@"/scp/test.txt", new DirectoryInfo(@"C:\Users\Administrator\Desktop"));
                  System.Console.WriteLine("DOWNLOAD SUCCEEDED");
  
                  scp.Disconnect();
                  System.Console.WriteLine("SCP DISCONNECTED");
              }
           }
  </code></pre>