How to backup in Windows using rclone

I would like to show how I use rclone to backup files from Windows PC to the cloud. I think it works very nicely, better than any of the commercial options I have seen.

I have already setup rclone to work with my cloud, this part is not covered in this post. The aim is to backup selected files and folders once per day. If there has been changes in files, the old files are moved to 'old' folder inside the cloud. The files in old folder have file extension as current date.

I have file called daily.bat stored in c:\apps\rclone folder. In Windows task scheduler I have set daily.bat to be run once per day.

The content of daily.bat file

@echo.
@echo Rclone backup to pcloud
@echo off
FOR /F "skip=1" %%D IN ('WMIC OS GET LocalDateTime') DO (SET LD=%%D & GOTO :GOT_LD)
:GOT_LD
SET DATETIME=%LD:~6,2%%LD:~4,2%%LD:~0,4%_%LD:~8,2%%LD:~10,2%%LD:~12,2%

:: Backup entire folder including subfolders
c:\apps\rclone\rclone.exe sync c:\apps\py            backup:current/py            --backup-dir backup:old/py            --suffix .%DATETIME% --log-level INFO --log-file=c:\apps\rclone\rclog.log
c:\apps\rclone\rclone.exe sync c:\apps\Customers     backup:current/Customers     --backup-dir backup:old/Customers     --suffix .%DATETIME% --log-level INFO --log-file=c:\apps\rclone\rclog.log

:: Backup single file
c:\apps\rclone\rclone.exe copy c:\Users\jack\AppData\Roaming\Mozilla\Firefox\Profiles\lfx2pskr.default-release\logins.json backup://current/firefox/ --backup-dir backup://old/firefox/ --suffix .%DATETIME% --log-level INFO --log-file=c:\apps\rclone\rclog.log
c:\apps\rclone\rclone.exe copy c:\Users\jack\AppData\Roaming\Mozilla\Firefox\Profiles\lfx2pskr.default-release\key4.db     backup://current/firefox/ --backup-dir backup://old/firefox/ --suffix .%DATETIME% --log-level INFO --log-file=c:\apps\rclone\rclog.log

Thats it. Just wanted to show an example.

hi,
thanks for sharing.
tho might change the topic category from help and support to howto guides.

i run a variation of your command that:
--- does not to mangle the file names
--- saves log file per run
--- easier to recover from ransomware/disaster

@set name=py
rclone sync c:\apps\%name% backup:%name%/current --backup-dir=backup:%name%/old/%datetime% --log-level INFO --log-file=c:\apps\rclone\logs\%name%\%datetime%.log

and might want to check out my howto guide about using VSS.
https://forum.rclone.org/t/i-want-to-share-how-to-enable-vss-for-rclone/11644

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.