How to deal with --backup-dir?

Hi,

I'm on Windows (10, x64) and using rclone v1.50.2.

I want to sync the contents of (multiple) local folders on a local drive to another local drive.

This is the sample batch file:

@FOR /F "tokens=2 delims==" %A IN ('wmic OS Get localdatetime /value') DO SET "dt=%A"
SET "YY=%dt:~2,2%" & SET "YYYY=%dt:~0,4%" & SET "MM=%dt:~4,2%" & SET "DD=%dt:~6,2%"
SET "HH=%dt:~8,2%" & SET "NN=%dt:~10,2%" & SET "SS=%dt:~12,2%"
SET Fullstamp=%YYYY%-%MM%-%DD%_%HH%-%NN%-%SS%

SET RCLONEDIR=D:\Tools\@Command Line Tools\rclone_x64

REM Sync
SET SRC_DRIVE=D:
SET DST_DRIVE=T:

REM This is the part to repeat for each directory to backup!
SET SRC_FLDR=Install

SET SRC_PATH=%SRC_DRIVE%\%SRC_FLDR%
SET DST_PATH=%DST_DRIVE%\rclone_tst\backup\users\%USERNAME%\%SRC_FLDR%
REM %ARCHIVES% must be ONE LEVEL ABOVE of %DST_PATH%!
SET ARCHIVES=%DST_DRIVE%\rclone_tst\backup\users\%USERNAME%\!ARCHIVES_%SRC_FLDR%!\%Fullstamp%


# Copy between two local drives
rclone.exe --config "%RCLONEDIR%\.rclone.conf" sync -P --retries 1 --ignore-case --filter-from "%RCLONEDIR%\filters.txt" "%SRC_PATH%" nounc:"%DST_PATH%" --backup-dir nounc:%ARCHIVES%

So the resolved path of DST_PATH is

T:\rclone_tst\backup\users\me\Install

And the ARCHIVES path is

T:\rclone_tst\backup\users\me\!ARCHIVES_Install!\2019-12-12_15-34-14  

Fine so far. rclone will create that path and move any updated files into it before it copies over the changed ones.
BUT: It will always create a new timestamped folder and DELETE any existing ones beforehand!
So I will always only have one backup and not multiple ones (until I clean them up myself).

Can I do anything against this behavior?

not sure that this is the cause of your problem but for the rclone command you do not have quotes around the %ARCHIVES%, but you do have quotes around "%SRC_PATH%" and "%DST_PATH%"

Thanks asdffdsa!

This is not the solution, but it made me think over that variable again, leading to:
While experimenting I was working with the console and update all set environment variables in there. Guess what, I didn't update the timestamp variable and ofc rclone just overwrote that (old) directory, instead of creating a new one. Holy cow. I'm truly sorry!

Is it ok to delete the whole thread? It really serves no purpose... apart from showing that the problem was my brain...

yeah, no problem, we all have brain farts.

so delete it if you can; before anybody else read this post

I can't, no permission to do this...

I've marked your first answer as the solution then :slight_smile:

Thanks again!

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