6

I am copying some assets from one folder to another using robocopy in command prompt. However, 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".

Actual Scenario: We are going to run a scheduler once daily. This scheduler will copy all the assets from one folder to another.

Refer below link for a screenshot of Robocopy Command:

Robocopy

Any help will be highly appreciated :-)

8

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

  • After a long discussion we were able to get a command working .... but what happens with this command is that it overwrites the previous log. I want it to create a new log life (.txt) the next day (each day will have a new log file in the name of current date) – Yash Saraiya Oct 21 '15 at 3:41
  • Can you please check this link superuser.com/questions/1104796/… and let me know if you have an answer for this ? – Yash Saraiya Jul 25 '16 at 10:04
  • No. Pinging users to answer unrelated questions is not acceptable behaviour. Please don't do that. – DavidPostill Jul 25 '16 at 10:13
  • Ok. Sure. I thought you might have an answer for this. But that's alright. Sorry for the trouble. – Yash Saraiya Jul 25 '16 at 10:23
1

The log of RoboCopy is in DOS format which isn't really good.. Try GS RichCopy - has got all the features of RoboCopy, but it has some more features like copying open/locked files, can copy the timestamps, and has a GUI interface with a nice looking log which you can easily copy and paste in a notepad.

  • 2
    Welcome to superuser: Please read the question again carefully. Your answer does not answer the original question."How do I create a log of robocopy actions and save in a text file named with today's date? ” under Event Trace Sessions after the Anniversary Update?" the OP stated "using robocopy in command prompt." software advice is generally best with more information and links but not so much that it looks like an add. Please take a couple of minutes and read:- superuser.com/help .Answering: superuser.com/help/how-to-answer, again welcome to superuser.Thankyou – mic84 Feb 7 '18 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.