Using rclone to backup OneDrive or Google Drive

 
 
  • Gérald Barré

If you have important files, you should back them up before it's too late. Cloud drives such as OneDrive, Google Drive, or pCloud are convenient storage solutions, but they are not a complete backup strategy. You may want to keep an additional local copy of your data.

rclone is a free tool that can synchronize a local directory with a remote directory. rclone supports most cloud providers. Its command-line interface makes it easy to invoke on demand, and its synchronization feature can retain the full history of your files so you can always restore your data.

First, you need to download rclone from the website: https://rclone.org/downloads/.

If you already have rclone downloaded, you can update it to the latest version using the following command:

PowerShell
rclone selfupdate --stable

Then, you need to link your cloud drives to rclone. This step creates a configuration file containing the details needed to connect to your accounts.

PowerShell
rclone config --config rclone.conf

Follow the prompts to add a new remote. Once complete, you should have a new configuration file named rclone.conf. You can view the available cloud drives by opening the file in a text editor:

PowerShell
$RemoteFolder = "DemoOneDrive:"
$LocalBackupFolder= "Backup"
$LastestBackupFolder = Join-Path $LocalBackupFolder "latest"
$HistoryBackupFolder = Join-Path $LocalBackupFolder ((Get-Date).ToString("yyyyMMdd-HHmmss"))

# sync documentation: https://rclone.org/commands/rclone_sync/
rclone sync $RemoteFolder $LastestBackupFolder --backup-dir="$HistoryBackupFolder" --config rclone.conf --track-renames --progress

After a few backups, you should see the latest folder alongside a few history folders:

Do you have a question or a suggestion about this post? Contact me!

Follow me:
Enjoy this blog?