How to Automate FolderClone Directory Sync FolderClone is a powerful command-line tool designed to clone and sync Google Drive directories using multiple service accounts. This allows users to bypass the daily 750GB upload limit imposed by Google. While manually running the copy command works, automating the process ensures your data remains updated without human intervention.
Here is a comprehensive guide to automating your FolderClone directory syncs using native system schedulers. Prerequisites
Before setting up automation, ensure you have the following components fully operational: Python 3 installed on your system. FolderClone installed via pip.
Service Accounts (Manager and Workers) properly configured and placed in your accounts directory.
A successful manual test run using the multimanager command. Step 1: Create a Centralized Execution Script
System schedulers can occasionally struggle with direct Python CLI commands due to environment variables. Creating a dedicated shell script (Linux/macOS) or batch file (Windows) ensures the task executes reliably. For Linux and macOS (sync.sh) Create a file named sync.sh in your FolderClone directory:
#!/bin/bash # Navigate to the FolderClone directory cd /path/to/your/folderclone # Activate virtual environment if you use one # source venv/bin/activate # Execute the sync command multimanager copy –source “SOURCE_FOLDER_ID” –destination “DESTINATION_FOLDER_ID” >> sync.log 2>&1 Use code with caution.
Make the script executable by running this command in your terminal: chmod +x /path/to/your/folderclone/sync.sh Use code with caution. For Windows (sync.bat) Create a file named sync.bat in your FolderClone directory:
@echo off cd /d “C:\path\to\your\folderclone” multimanager copy –source “SOURCE_FOLDER_ID” –destination “DESTINATION_FOLDER_ID” > sync.log 2>&1 Use code with caution. Step 2: Configure the Automation Scheduler
With your execution script ready, you can now schedule it to run at preferred intervals (e.g., daily at midnight). Method A: Automating on Linux/macOS with Crontab Linux and macOS utilize cron to handle background tasks. Open the crontab configuration window: crontab -e Use code with caution.
Add a new line at the bottom of the file to schedule the sync. For example, to run the sync every day at 12:00 AM, add: 0 0/path/to/your/folderclone/sync.sh Use code with caution. Save and close the editor. The automation is now live. Method B: Automating on Windows with Task Scheduler
Windows users can leverage the built-in Task Scheduler utility.
Open the Start menu, search for Task Scheduler, and launch it. Click Create Basic Task in the right-hand Actions panel. Name your task (e.g., “FolderClone Sync”) and click Next.
Choose your preferred frequency (e.g., Daily) and set the start time. In the Action step, select Start a program. Click Browse and select your sync.bat file.
In the “Start in (optional)” field, paste the absolute path to your FolderClone folder (C:\path\to\your\folderclone). Click Finish to save the task. Step 3: Monitoring and Troubleshooting
Automated tasks run quietly in the background, making robust logging essential.
Check the Log Files: The scripts provided above automatically create a sync.log file in your FolderClone directory. Open this file to review the transfer progress or spot error codes.
Handle Token Expirations: If your sync suddenly fails, check if your Google service account JSON keys are still valid or if permissions on the source/destination folders have changed.
Avoid Sync Overlaps: If you are moving massive amounts of data, a new scheduled sync might trigger before the previous one finishes. If this occurs, increase the time gap between your scheduled tasks.
By offloading FolderClone to your system scheduler, you create a hands-off, continuous backup system that maximizes your Google Drive storage workflows efficiently.
To help tailor this automation setup to your exact environment, please let me know:
Leave a Reply