I am running a robocopy job through a batch file that is scheduled to run every hour. I am using the following switches:
Robocopy \servername\share D:\somedir /E /R:5 /Log+:D:\Logs\CopyLog.txt
It has been working faithfully for a long time but it ran into a snag this morning. I went to check the log file and was suprised to find it had grown to just shy of 280 Mb.
My question then is how I can change my batchfile to write more managable log files? I think it would make sense to append on a period for which it is reported in. ie: CopyLog_201103.txt would be the log file for March 2011.
I’m fairly adept at working with higher level programming languages, but command line programming was already long gone by the time I was growing up. I’m definitely learning the value of getting a firm understanding of the much more basic computer concepts.
Any suggestions/advice would be appreciated, thanks in advance.
You can get the day, month and year using this cmd snippet:
(Warning: locale specific.)
Now you can write to different log files as you see fit.