RClone Win2019 Scheduled Tasks date in logfile

What is the problem you are having with rclone?

RClone is not processing the %DATE% environment variable in a scheduled task to generate a log file. This is ONLY an issue within scheduled tasks, not when running manually from a command prompt.

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

rclone v1.59.1

  • os/version: Microsoft Windows Server 2019 Standard 1809 (64 bit)
  • os/kernel: 10.0.17763.3287 (x86_64)
  • os/type: windows
  • os/arch: amd64
  • go/version: go1.18.5
  • go/linking: static
  • go/tags: cmount

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

No cloud storage involved, this is between a local drive and a UNC file share.

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

rclone sync --metadata  R:\catproc\backups  \\\catproc\backups --log-file "R:\rclonelogs\backups_%DATE%.log" --log-level=INFO

The logfile created is literally "backups_%DATE%.log. Tried escaping out the %DATE% variable with quotes, as well as removing any quotes, adding quotes, etc. Also tried lowercase (%date%) as well, no change. It's insisting on taking it literally. I can live with a static log file but it's going to make my log rotation really messy as I'm trying to run 10 of these on different paths to sync a couple of file servers.

The rclone config contents with secrets removed.

No config file

A log from the command with the -vv flag

No log gets created running the command manually. But the strange thing is, the %DATE% variable IS actually processed correctly:

rclone sync --metadata  R:\catproc\backups  \\\catproc\backups --log-file "R:\rclonelogs\backups_%date%.log" --log-level=INFO -vv
2022/09/26 13:54:52 Failed to open log file: open R:\rclonelogs\backups_Mon 09/26/2022.log: The system cannot find the path specified.


%date% will output Mon 09/26/2022 which is not a valid filename.

might try something like in a .cmd script

for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set datetime=%%I
set thedate=%datetime:~0,4%%datetime:~4,2%%datetime:~6,2%
echo %thedate%

which will output

and if you want task scheduler to process %date%, need to run the task using cmd.exe, like so


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