title: Download one specific file from SFTP server using SSH.NET
body: <p>I am trying to download only one file using SSH.NET from a server.</p>
  
  <p>So far I have this: </p>
  
  <pre><code>using Renci.SshNet;
  using Renci.SshNet.Common;
  ...
  public void DownloadFile(string str_target_dir)
      {
          client.Connect();
          if (client.IsConnected)
          {
              var files = client.ListDirectory(@"/home/xymon/data/hist");
              foreach (SftpFile file in files)
              {
                  if (file.FullName== @"/home/xymon/data/hist/allevents")
                  {
                      using (Stream fileStream = File.OpenWrite(Path.Combine(str_target_dir, file.Name)))
                      {
                          client.DownloadFile(file.FullName, fileStream);
                      }
                  }
              }
          }
          else
          {
              throw new SshConnectionException(String.Format("Can not connect to {0}@{1}",username,host));
          }
      }
  </code></pre>
  
  <p>My problem is that I don't know how to construct the <code>SftpFile</code> with the string <code>@"/home/xymon/data/hist/allevents"</code>.</p>
  
  <p>That's the reason, why I use the <code>foreach</code> loop with the condition.</p>
  
  <p>Thanks for the help.</p>