Forever forward incremental backup using a .bat file in Win 11

What is the problem you are having with rclone?

I want to a simple forever forward incremental backup using a .bat file in Win 11.
I want my C:/ to be backed up to Z:/rClone/Backup/C_Drive
I want my incrementals (ie. the files that are being replaced or deleted from Z:/rClone/Backup/C_Drive) to go into Z:/rClone/Incremental/C_Drive/ and have the filename with the original date of copy appended.

How do I get the incremental copies to include the original date of backup (or even the date it was copied into incremental) to append to the filename?

Run the command 'rclone version' and share the full output of the command.

rclone v1.69.0

  • os/version: Microsoft Windows 11 Pro 23H2 23H2 (64 bit)
  • os/kernel: 10.0.22631.4751 (x86_64)
  • os/type: windows
  • os/arch: amd64
  • go/version: go1.23.4
  • go/linking: static
  • go/tags: cmount

Are you on the latest version of rclone? Yes 1.69

Which cloud storage system are you using? (eg Google Drive)

Local Drives.

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone sync  C:/  Z:/rClone/Backup/C_Drive --backup-dir=Z:/rClone/Incremental/C_Drive/ --dry-run

A log from the command that you were trying to run with the -vv flag

Its working, just the incremental folder has no dates in the incremental files. I just don't know how to append the date.
ChatGPT keeps making me .bat files which try to append the date, but it dosn't work. Has anyone got a working .bat file for doing incremental backup in windows 11?

This is in the forums, but I assume its for linux.
rclone sync  /var/www/html/nextcloud/data/ remote:bucketname/data/full --backup-dir=remote:bucketname/data/incrementals/`date +%Y%m%d.%I%M%S` -vv --dry-run


welcome to the forum,

much debated in the forum, that --backup-dir is not forever forward incremental backup

@for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set datetime=%%I
@set datetime=%datetime:~0,4%%datetime:~4,2%%datetime:~6,2%.%datetime:~8,2%%datetime:~10,2%%datetime:~12,2%
rclone sync c:/ z:/rclone/backup/c_drive --backup-dir=z:/rclone/incremental/c_drive/%datetime%

so, %datetime% = 20250130.120731


fwiw, if you are trying to sync the root of the c: drive, i would not use rclone.

what is the logic to backup folders such c:\program files, c:\windows
can exclude them using filters, such as --exclude and --exclude-from

here is another version

echo off
::setlocal
rem use findstr to strip blank lines from wmic output
for /f "usebackq skip=1 tokens=1-6" %%g in (`wmic Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year ^| findstr /r /v "^$"`) do (
  set year=%%l
  set month=00%%j
  set day=00%%g
  set hours=00%%h
  set minutes=00%%i
  set seconds=00%%k
  )

set year=%year:~-4%
set month=%month:~-2%
set day=%day:~-2%
set hours=%hours:~-2%
set minutes=%minutes:~-2%
set seconds=%seconds:~-2%

@set currentdatetime=%year%.%month%.%day%.%hours%.%minutes%.%seconds%
::set thedate=%year%%month%%day%
echo %currentdatetime%

which would output 2025.01.30.12.41.23

It is not exactly what you are asking but I created dfb: GitHub - Jwink3101/dfb: Full-file, append-only, backups that can be easily restored to any point in time. Can backup to and from *any* rclone remote.

It used rclone under the hood. It backs up all new or modified files with the date of backup in the filename. It marks deletes with a small delete flag, and can optionally track renames with references.

While it is less efficient than tools like Kopia or restic, the simplicity and robustness is a major win! You don't even need to use dfb to restore if you don't want to! The backup can be manually interrogated easily.

It is also append only outside of purge commands. This makes it amenable to immutable or WORM storage. And you can restore to any point in time that hasn't been purged!

1 Like

It is nice piece of software! And indeed its simplicity is something unique.

However I am in agreement with @asdffdsa here. Using rclone to backup root of C: drive in Windows is VERY bad idea. Starting with nightmare exclusions list to catch all stuff which plainly won't be even accessible by tool like rclone. And ending with preserving various Windows files privileges and attributes. Overall it is waste of time and result will be useless for any serious recovery and it is what backup is for.

@windsp-coding - do your homework and find right tool for the job. There are many including FOSS or free versions of commercial software. Windows is rather special when it comes to boot drive backup and simple tools like rclone are not fit for this purpose.

too true. i have posted about that a bunch of times in the forum, and about the correct backup tools.
even if OP could survive nightmare exclusions, the next issue is rclone cannot copy files that are locked or in-use.


https://forum.rclone.org/t/how-to-enable-vss-for-rclone-on-windows/11675
luckily, in four lines of dumb dos, can get windows to create VSS snapshots.

this technique is very simple, works on windows desktop and windows servers, and i have been using it on many servers and desktops for 7+ years. i figure i have done several 10,000s of snapshots.

the snapshots are temporary, disables writers and self-deletes after the snapshot is not in-use for a period of time.
they are also very lightweight, i once ran 10 backups at the same time, each creating its own snapshot.

i know that zfs and btfrs get the snapshot spotlight, but windows VSS snapshots are fantastic and easy to create.

i recommend free veeam agent. but i also purchase acronis true image for the boot iso.

so, a bonus of the way that howto creates the snapshots, they can run at the same time as as veeam agent is running its own backup using its own snapshot.
makes scheduling multiple backups using multiple software products a no-brainier.

Thanks everyone for your helpful and thoughtful replies!

  1. No, I wasn't going to backup the whole C Drive, sorry. Was trying to simplify. I will backup selected folders in C Drive I want to make sure I have easy access to backup data . Some folders incremental, some just straight syncs.
  2. I appreciate the suggestions for system imaging, but I really just want a local backup of files with some being incrementally backed up.
  3. I nearly went for DFB, but my brain couldn't quite handle another layer of commands to sort out. Appreciate the effort on the github.
  4. I really appreciate this rclone for making multiple OneDrives possible on my computer. Brilliant software, thank you!
  5. I ended up using asdffdsa's .bat file and made an excel spreadsheet to populate it with commands for ~20 folders.
  6. Question: When I run a bat file with 20 rclone commands one after another, does it call rclone 20 times, in series, waiting for the previous to finish. Or does it run them in parallel? My hope is very much in series. Otherwise I will need to make 20 seperate .bat files.

My final working .bat file with 2 rclone commands.
I will probably run it once a day. Tempted to run it once an hour, but I imagine that will cause a lot of overhead? (--max-age=1h, I don't think will stop rclone needing to check millions of files latest modified date?)

code[code]
echo off
::setlocal
rem use findstr to strip blank lines from wmic output
for /f "usebackq skip=1 tokens=1-6" %%g in (wmic Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year ^| findstr /r /v "^$") do (
set year=%%l
set month=00%%j
set day=00%%g
set hours=00%%h
set minutes=00%%i
set seconds=00%%k
)

set year=%year:~-4%
set month=%month:~-2%
set day=%day:~-2%
set hours=%hours:~-2%
set minutes=%minutes:~-2%
set seconds=%seconds:~-2%

@set currentdatetime=%year%-%month%-%day%.%hours%-%minutes%-%seconds%
::set thedate=%year%%month%%day%
echo %currentdatetime%

rclone sync "C:/rclone/" "Z:/rclone/backup/C/rclone/" --backup-dir="Z:/rclone/incremental/C/rclone/%currentdatetime%/"
rclone sync "C:/DigiKam DataBases/" "Z:/rclone/backup/C/DigiKam DataBases/"
code[/code] (modplzcodemycodeIcant)

well, that is up to you and the script you write.

can create a simple text file, let's call it include.txt

/rclone/
/DigiKam DataBases/
rclone sync c:/ z:/rclone/backup --backup-dir=z:/rclone/incremental/%currentdatetime%/ --include-from=include.txt
1 Like

Hmmm, can't get the the include.txt to work for directories 2 layers deep.
So using my original .bat with call for each rclone command, to make sure they run in series.

Thanks again!

echo off
::setlocal
rem use findstr to strip blank lines from wmic output
for /f "usebackq skip=1 tokens=1-6" %%g in (wmic Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year ^| findstr /r /v "^$") do (
set year=%%l
set month=00%%j
set day=00%%g
set hours=00%%h
set minutes=00%%i
set seconds=00%%k
)

set year=%year:~-4%
set month=%month:~-2%
set day=%day:~-2%
set hours=%hours:~-2%
set minutes=%minutes:~-2%
set seconds=%seconds:~-2%

@set currentdatetime=%year%-%month%-%day%.%hours%-%minutes%-%seconds%
::set thedate=%year%%month%%day%
echo %currentdatetime%

call rclone sync "C:/rclone/" "Z:/rclone/backup/C/rclone/" --backup-dir="Z:/rclone/incremental/C/rclone/%currentdatetime%/" -vv
call rclone sync "C:/DigiKam DataBases/" "Z:/rclone/backup/C/DigiKam DataBases/"

include.txt

/dir/subdir1/**
/dir/subdir2/**

tip: filters works only on the source. the safest, best way to experiment is using rclone ls, not rclone sync

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