I wanted to download a folder from the GitHub branch. But how can we download only a folder (or part of the source), there is no option on the GitHub website to download a folder.
At the time of writing this easiest way to do this is to use the code sandbox.
Here is the magic
Open repo to code sandbox by replacing github to githubbox in URL. Then on code sandbox go to files pain on the left and hover the mouse over the down arrow, it will show a popup tooltip “Export to Zip”. Just click on it to download the folder as a zip file.
Here is an example
In this example I am downloading the “RazorPagesWeb-CSharp” folder from the “aspnetcore” repo in github. The folder structure is similar to this:
aspnetcore/
├── main/
│ ├── .......
│ ├── docs
│ ├── .......
│ ├── src
│ └── .......
└── release/2.2
|...........
├── docs
├── .........
└── src
|...........
└─── Templating
|...........
├── src
│ |...........
│ ├── Microsoft.DotNet.Web.ProjectTemplates
│ │ |...........
│ │ └─── content
│ │ |...........
│ │ └── RazorPagesWeb-CSharp
│ │
│ │...........
├
│...........
To get the following small size folder from the huge aspnetcore repo:
https://github.com/dotnet/aspnetcore/tree/v2.2.13/src/Templating/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp
Just change only the github.com part of the URL to githubbox.com as shown below:
https://githubbox.com/dotnet/aspnetcore/tree/v2.2.13/src/Templating/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp
Note:
This article was first published in my blogspot site. Due to storage issues I decided to move it here.







