Secure One-Way Sync from Windows Server to Google Drive Using Rclone & Autoscript

Manoj KumarManoj Kumar
5 min read

โœจ Project Overview

For a Kentucky-based law firm, I implemented a robust and secure one-way file synchronization system from a local Windows Server 2025 to Google Drive using Rclone. The goal: allow 30 staff members to indirectly access synchronized case files (~800 folders) while leveraging Google Gemini AI for document analysis.

๐Ÿ› ๏ธ Phase 1: Requirements & Planning

Client Needs

  • One-way sync: Local โ†’ Google Drive only

  • 15-minute sync frequency

  • Retention of deleted files in Google Drive

  • Secure, encrypted data transfer

  • Minimal access to raw sync data

Chosen Solution

  • Rclone: Powerful CLI sync tool

  • Google Workspace Business Plus: Destination for cloud storage

  • Windows Task Scheduler: For automation


๐Ÿ’ป Phase 2: Rclone Setup

1. Download & Install Rclone

# Download and unzip
mkdir C:\rclone
cd C:\rclone
curl -O https://downloads.rclone.org/rclone-current-windows-amd64.zip
# Unzip manually or with software

2. Configure Google Drive Remote

C:\>cd rclone-v1.69.3-windows-amd64
C:\rclone-v1.69.3-windows-amd64>rclone config
# Make a New remote (choose n)
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n

# Whatever you want to give (lets give this name "gdrive")
Enter name for new remote.
name> gdrive

Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.

# Enter 20 (in my case I choosed 20, Google Drive listed number on 20)
Storage> 20

Option client_id.
Google Application Client Id
Setting your own is recommended.
See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
Enter a value. Press Enter to leave empty.
-------------------------------------------------------------------------------
โœ… Recommendation for You
I recommend:
๐Ÿ‘‰ Use the built-in Rclone credentials for now:
Start rclone config
Leave client_id and client_secret blank
Continue as normal
Note: Google Chrome is recommanded, it will required for auth for this.
-------------------------------------------------------------------------------
client_id>

# Also Enter Blank
Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret>

# Select 1
Option scope.
Comma separated list of scopes that rclone should use when requesting access from drive.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
 1 / Full access all files, excluding Application Data Folder.
   \ (drive)
 2 / Read-only access to file metadata and file contents.
   \ (drive.readonly)
   / Access to files created by rclone only.
 3 | These are visible in the drive website.
   | File authorization is revoked when the user deauthorizes the app.
   \ (drive.file)
   / Allows read and write access to the Application Data folder.
 4 | This is not visible in the drive website.
   \ (drive.appfolder)
   / Allows read-only access to file metadata but
 5 | does not allow any access to read or download file content.
   \ (drive.metadata.readonly)
scope> 1

# Select Defaul Option
Option service_account_file.
Service Account Credentials JSON file path.
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`.
Enter a value. Press Enter to leave empty.
service_account_file>

Edit advanced config?
y) Yes
n) No (default)
y/n> n

# It's Time to configure on browser you need to authorization only.
Use web browser to automatically authenticate rclone with remote?
 * Say Y if the machine running rclone has a web browser you can use
 * Say N if running rclone on a (remote) machine without web browser access
If not sure try Y. If Y failed, try N.

y) Yes (default)
n) No
y/n> y

2025/05/29 06:30:51 NOTICE: Make sure your Redirect URL is set to "http://127.0.0.1:53682/" in your custom config.
2025/05/29 06:30:56 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=5tQ-NU4KRiiA-2r5KSXckg
2025/05/29 06:30:56 NOTICE: Log in and authorize rclone for access
2025/05/29 06:30:56 NOTICE: Waiting for code...
2025/05/29 06:34:52 NOTICE: Got code

Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No (default)
y/n> n

Configuration complete.
Options:
- type: drive
- scope: drive
- token: {"access_token":"xxxx"}
- team_drive:
Keep this "gdrive" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y

Current remotes:

Name                 Type
====                 ====
gdrive               drive

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q>

# Congratulations you have successfully setup your infra.

๐Ÿš€ Phase 3: Test Initial Sync

rclone sync "C:\CaseTest" gdrive:LawFirmTestSync

Note: I have already created a CaseTest folder in C drive and LawFirmTestSync is my client test folder in Google Drive, you can create new folder or rename with LawFirmTest Sync


๐Ÿ“‹ Phase 4: Automation Script

5. Create .bat Script

@echo off
:: Rclone Google Drive One-Way Sync Script
:: Author: [Your Name or Company]
:: Created: %DATE% %TIME%

:: Set Rclone directory
cd /d C:\rclone

:: Perform one-way copy (preserve files on Google Drive)
rclone copy "C:\CaseTest" gdrive:LawFirmTestSync --log-file=C:\rclone\logs\sync_%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%.log --log-level=INFO

:: Optional: Email or alert system can be integrated here (Phase 3)
exit

Save as C:\rclone\rclone_sync.bat


โฐ Phase 5: Task Scheduler Automation

6. Open Task Scheduler & Create New Task

  1. General Tab:

    • Name: Rclone Google Sync

    • Run with highest privileges

  2. Triggers Tab:

    • Daily

    • Repeat every 15 minutes

  3. Actions Tab:

    • Program: C:\rclone\rclone_sync.bat
  4. Settings Tab:

    • Allow run on demand

    • Stop task after 30 mins

7. Test It

Right-click the task โ†’ Run. Check Google Drive & logs in C:\rclone\logs\


๐Ÿ“„ What I Deliverables to Client

  • โœ… Rclone config setup (local + shared drive)

  • โœ… .bat automation script

  • โœ… Task Scheduler integration

  • โœ… Three PDF guides

  • โœ… Remote training session

โš–๏ธ Tools Used

  • Rclone
  • Windows Server 2025
  • Google Workspace Enterprise
  • Task Scheduler

connect with me on Linkdin https://www.linkedin.com/in/manoj-kumar-18788b159/

0
Subscribe to my newsletter

Read articles from Manoj Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Manoj Kumar
Manoj Kumar