A simple tool I created to push local files to Google Drive so they're always updated and accessible from anywhere.
I built this tool because I needed a way to ensure my important files are always backed up to Google Drive and accessible from any device. Rather than manually uploading files or using the standard Drive client, this tool automates the process and provides more control over what gets synced.
The current version works well for basic sync operations, but I'm planning to extend it to run as a background service for continuous synchronization. I may also add a command-line interface (CLI) for more interactive control.
- One-way synchronization from local directories to Google Drive
- Selective syncing of specific directories
- Exclude specific files or directories from syncing
- Automatically creates folder structure in Google Drive
- Updates existing files if they've changed locally
- Go 1.18 or higher
- Google Drive API access
- Service account credentials JSON file
- Clone the repository:
git clone https://github.com/eyad-hussein/sync_with_cloud.git
cd sync_with_cloud- Build the application:
make buildThe application is configured via a YAML file (drive-sync.yaml). Here's an example configuration:
credentials_file: 'service-account-credentials.json'
root_folder_id: 'YOUR_GOOGLE_DRIVE_FOLDER_ID'
paths:
'/path/to/local/directory': 'remote-directory-name'
'/path/to/another/directory': 'another-remote-directory'
exclude:
'/path/to/local/directory/file-to-exclude.txt': ''
'/path/to/local/directory/directory-to-exclude': ''credentials_file: Path to the Google Drive service account credentials JSON fileroot_folder_id: The ID of the Google Drive folder where files will be synced topaths: A map of local paths to remote path namesexclude: A map of paths to exclude from syncing
- Go to the Google Cloud Console
- Create a new project
- Enable the Google Drive API
- Create a service account
- Download the service account credentials JSON file
- Save the credentials file to the same directory as the application
- Share the target Google Drive folder with the service account email
Run the sync process:
make runOr manually run the application:
./bin/sync_with_cloud- Run as a background service for continuous synchronization
- Command-line interface for more control and manual operations
- Code refactoring to improve maintainability and performance
- Add comprehensive unit tests for all components
make testmake lint