Automatically sync new files from your Mac to Google Drive once a day.
- 🔄 Daily synchronization via macOS launchd
- 📁 Tracks previously uploaded files (no duplicates)
- 🎯 Configurable source directory and file filters
- 📊 File size limits and exclude patterns
- 🔐 Secure OAuth 2.0 authentication with Google
- 📝 Detailed logging and progress reports
-
Install dependencies:
pip3 install -r requirements.txt
-
Configure Google Drive API:
- Download
credentials.jsonfrom Google Cloud Console - Place in this directory
- Download
-
Set up configuration:
cp config.example.json config.json # Edit config.json with your settings -
First run (authentication):
python3 mac_to_drive_sync.py --config config.json
-
Set up daily automation:
# Edit paths in mac_drive_sync.plist cp mac_drive_sync.plist ~/Library/LaunchAgents/ launchctl load ~/Library/LaunchAgents/mac_drive_sync.plist
{
"source_directory": "~/Documents",
"google_drive_folder": "Mac Backup",
"file_extensions": [".pdf", ".docx", ".jpg"],
"exclude_patterns": [".DS_Store", "._*"],
"max_file_size_mb": 100
}This is part of a larger file management system:
- drive-to-s3-lambda - Backs up Google Drive to AWS S3
- synagogue-file-search - Web interface to search files
- Authentication errors: Delete
token.pickleand re-run - File not syncing: Check
logs/sync.logfor details - Permission errors: Ensure script can read source directory
MIT License - See LICENSE for details.