Using rclone to backup OneDrive or Google Drive

 
 
  • Gérald Barré

If you have important files, you need to backup them before it's too late. Cloud drives, such as OneDrive, Google Drive, or pCloud, are great for this. However, this is not the perfect solution. And you may want to have another copy of your data.

rclone is a free tool that can synchronize a local directory with a remote directory. rclone supports most cloud providers. What I like about rclone is that it provides a command line, so it's very easy to invoke it when needed. Also, the synchronization feature can keep all 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 will create a configuration file that contains details to connect to your accounts.

PowerShell
rclone config --config rclone.conf

Follow the steps to add a new remote. Once this is completed you should have a new configuration file name rclone.conf. You can see 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 get the latest folder and a few history folders:

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

Follow me:
Enjoy this blog?Buy Me A Coffee💖 Sponsor on GitHub