title: C# Download complete directory structure with subdirectories and files from GitHub (Octokit.Net)
body: <p>I'm trying to figure out (in C#) how to download a directory with content (files and folders) in my GitHub repository through the API. Some of the articles mention Octokit.Net so i downloaded this and wrote the following lines:</p>
  
  <pre><code>var github = new GitHubClient(new ProductHeaderValue("PROJECT"), new InMemoryCredentialStore(new Credentials("xxxtokenxxx")));
  
  var repositories =  github.Repository.GetAllForCurrent().Result;
  
  var repository = repositories.Single(x =&gt; x.Name == "MyRepo");
  </code></pre>
  
  <p>Well i then get the repository and it works but i'm not sure where to go from here?</p>
  
  <p>How can i download Folder1 (look below) containing all files and Folder2 with files in a structure to my local hard disk?</p>
  
  <p><a href="https://github.com/PROJECT/MyRepo/tree/2016-1/Folder1/Folder2" rel="nofollow noreferrer">https://github.com/PROJECT/MyRepo/tree/2016-1/Folder1/Folder2</a></p>
  
  <p>Can anyone help me in the right direction? Your help is greatly appreciated. Thanks</p>