A simple command-line tool to download a specific folder from a GitHub repository.
- Download any folder from a public or private GitHub repository.
- Refresh previously downloaded folders to pull the latest changes.
- Parallel downloads for faster performance.
- Respects
.env
files for GitHub API token authentication.
You can install github-dl
directly from crates.io using Cargo:
cargo install github-dl
To download a folder, use the download
command with the GitHub folder URL and an output directory.
github-dl download <GITHUB_URL> -o <OUTPUT_DIRECTORY>
Example:
github-dl download "https://github.com/rust-lang/book/tree/main/src/ch01-00-introduction" -o ./rust-book-intro
This will download the contents of the ch01-00-introduction
folder into the ./rust-book-intro
directory.
The tool creates a hidden .github-dl.json
metadata file in the output directory. This allows you to easily refresh the folder's contents later.
To refresh all downloaded folders in the current directory (or a specified base directory), use the refresh
command.
# Refresh folders in the current directory
github-dl refresh
# Refresh folders in a specific base directory
github-dl refresh --base-dir /path/to/projects
The refresh
command will scan for .github-dl.json
files recursively and update the contents of each folder from its original GitHub source.
You can control the number of parallel downloads using the -j
or --jobs
flag. The default is 5.
github-dl download <URL> -o <OUTPUT> -j 10
For private repositories or to avoid hitting GitHub's API rate limits, you can provide a personal access token.
Create a .env
file in the directory where you run the command (or in any parent directory) with the following content:
GITHUB_TOKEN=your_personal_access_token_here
github-dl
will automatically detect and use this token for all API requests.
This project is licensed under either of
- Apache License, Version 2.0
- MIT license
at your option.