How do I create a log of robocopy actions and save in a text file named with today's date?

I want to log name of all those copied assets in a .txt file.

This .txt file should be saved in the form of "currentDate.txt".

  • Use the robocopy /log:<LogFile> option.

  • You might also want to use the /tee option

    Writes the status output to the console window, as well as to the log file.

Example batch file (copyassets.cmd):

@echo off
for /f "tokens=1-3 delims=/ " %%a in ('date /t') do (
  set _date=%%a%%b%%c
  )
echo robocopy ship shore /log:%_date%.txt
  • Modify as you like to get your prefered date format.
  • Remove the last echo if you are happy with the date format
  • Use /s if your source directory contains subdirectories that need copying.

Syntax

robocopy <Source> <Destination> [<File>[ ...]] [<Options>]

...

Logging options

...

enter image description here

Source Robocopy