An automated backup tool that organizes documents (txt, docx, pptx, md, etc.) into a folder hierarchy and uploads them to GitHub.
- Smart Folder Hierarchy: Organizes backups by date → year → month → week → file type
- Multiple File Types: Supports
.txt,.docx,.doc,.pptx,.ppt,.md,.pdf,.xlsx,.xls,.csv,.json,.xml - GitHub Integration: Automatic upload to GitHub via SSH
- Size Limitation Handling: Logs files over 25MB with detailed information
- Exclusion Support: Respects path exclusion patterns from
exlude_paths.txt - Detailed Logging: Generates exclusion logs for monitoring
[Backup Root]/
└── [YYYY-MM-DD] (Backup Date)
└── YYYY (Year)
└── MM (Month)
└── W##(Week)
├── docx/
│ └── [files]
├── txt/
│ └── [files]
├── md/
│ └── [files]
└── [other extensions]/
└── [files]
Edit main.py and update the source_directory:
source_directory = "C:\\Your\\Source\\Path" # Change thisEdit exlude_paths.txt to specify directories/patterns to exclude:
C:\Windows
C:\Program Files
C:\Users\*\node_modules
.git
__pycache__
Note: Patterns are case-insensitive and matched as substrings.
- Create a new GitHub repository for backups
- Copy the SSH URL (e.g.,
git@github.com:username/backups.git)
Windows:
# Generate SSH key (if you don't have one)
ssh-keygen -t rsa -b 4096 -f "$env:USERPROFILE\.ssh\id_rsa"
# Add public key to GitHub
# 1. Copy contents of C:\Users\YourUsername\.ssh\id_rsa.pub
# 2. Go to GitHub Settings → SSH and GPG keys → New SSH key
# 3. Paste and saveMac/Linux:
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa
# Then add the public key to GitHubEdit backup_config.txt:
GITHUB_REPO_URL=git@github.com:your-username/your-backup-repo.git
SSH_KEY_PATH=C:\Users\YourUsername\.ssh\id_rsa
COMMIT_MESSAGE=Auto backup from GitHub Backupper - {date}
Fields:
GITHUB_REPO_URL: SSH URL of your GitHub repositorySSH_KEY_PATH: Full path to your SSH private keyCOMMIT_MESSAGE: Commit message (supports{date}placeholder)
cd code
python main.pyWhen prompted, enter no to skip GitHub upload.
cd code
python main.pyWhen prompted, enter yes to upload to GitHub.
cd code
python -c "from github_uploader import upload_backup_to_github; upload_backup_to_github('path/to/backups')"Generated after each backup run, lists all files that were excluded due to size:
================================================================================
BACKUP EXCLUDED FILES LOG - 2025-04-20 15:30:45
================================================================================
The following files were EXCLUDED from backup due to exceeding 25MB size limit:
Total excluded files: 2
1. File: C:\Users\test1\Desktop\large_video.mp4
Size: 150.5 MB
Would be located: Backup folder structure would apply
2. File: C:\Users\test1\Documents\archive.zip
Size: 35.2 MB
Would be located: Backup folder structure would apply
- Maximum file size for GitHub upload: 25 MB (GitHub LFS required for larger files)
- Files exceeding this limit are:
- ✅ Listed in
backup_excluded.log - ✅ Not copied to backup folder
- ✅ Show exact size in MB
- ✅ Listed in
For files over 25MB, you have two options:
-
Use Git LFS (Recommended for GitHub):
git lfs install git lfs track "*.mp4" # or your large file extension
-
Add to exclusion list in
exlude_paths.txt
Main backup orchestrator that:
- Finds all supported files
- Creates folder hierarchy
- Handles exclusions
- Logs oversized files
- Prompts for GitHub upload
Handles GitHub operations:
- SSH key configuration
- Git repository initialization
- Commit and push operations
- Error handling
Configuration file with:
- GitHub repository URL
- SSH key path
- Custom commit messages
List of paths/patterns to exclude from backup
- Verify the path in
backup_config.txtis correct - Windows path should use backslashes or forward slashes:
C:\Users\name\.ssh\id_rsa
- Ensure SSH key is added to GitHub account
- Test SSH connection:
ssh -i path/to/key git@github.com
- Check
exlude_paths.txtfor matching patterns - Verify files have supported extensions
- Check permissions on source files
- Verify repository is empty or compatible
- Check network connectivity
- Review Git error messages in console
| Extension | Supported |
|---|---|
| .txt | ✅ |
| .docx | ✅ |
| .doc | ✅ |
| .pptx | ✅ |
| .ppt | ✅ |
| .md | ✅ |
| ✅ | |
| .xlsx | ✅ |
| .xls | ✅ |
| .csv | ✅ |
| .json | ✅ |
| .xml | ✅ |