This script allows you to automatically download all your GitHub project files from their respective repositories. It is specifically designed to work with repositories listed in a remote README.md
file, where each repository is specified in a bullet point format.
- Fetches a remote
README.md
file containing a list of repositories. - Parses the repository names from the
README.md
file. - Generates URLs to download project files directly from the
main
branch. - Downloads project files to the current working directory.
- Provides feedback for each download process.
- Python 3.x
The script uses the following built-in Python modules:
os
urllib.request
requests
http.client
urllib.parse
No external modules are required for this script.
- Clone or copy this script to your local machine.
- Ensure you have Python 3.x installed.
-
Edit the script to point to the correct remote
README.md
file by modifying theurl
variable:url = "https://raw.githubusercontent.com/your-username/your-repo/refs/heads/main/README.md"
Replace
your-username
andyour-repo
with the appropriate GitHub username and repository. -
Run the script using the following command:
python kproject-updater.py
-
The script will:
- Fetch the remote
README.md
file. - Parse the project names from the file.
- Generate download URLs for each project.
- Download the respective
.py
files into the current working directory.
- Fetch the remote
- Fetches the remote
README.md
file using the provided URL. - Parses the file to extract lines starting with a dash (
-
) to identify project names. - Generates download URLs for each project based on a consistent naming convention.
- Downloads the project files using
urlretrieve
. - Saves each file to the current script directory.
- Displays the generated URLs for each project.
- Confirms successful download or reports errors for individual files.
Example:
project1 : https://raw.githubusercontent.com/username/project1/refs/heads/main/project1.py
Downloaded project1.py successfully!
project2 : https://raw.githubusercontent.com/username/project2/refs/heads/main/project2.py
Downloaded project2.py successfully!
All Projects Are Updated.
- Assumes all repositories use the same naming convention for their
.py
files (i.e.,<repository_name>.py
). - Relies on the structure and format of the remote
README.md
file.
To customize the script:
- Modify the
url
variable to point to your ownREADME.md
file. - Update the
generate_urls
function if your project file naming conventions differ.