logging - Generating managable log files on a batch file job -


I am running a robocopy job through a batch file that is scheduled to run every hour. I am using the following switch:

Robocopi \ server name \ stock D: \ somedir / E / R: 5 / tag +: D: \\ Logs \ CopyLog.txt < P> It has been working sincerely for a long time but it ran into a problem this morning. I went to the log file to check and was surprised to find that it was just shy of 280 Mb.

My question is how can I change my batch file to write more manageable log files? I think it would mean to attach it to that period for which it is notified i.e.: CopyLog_201103.txt will be a log file for March 2011.

I'm quite skilled at working with high level programming, but command line programming has already gone on long enough when I was growing

any suggestions / Advice would be appreciated, thanks in advance.

You can get day, month and year using this CMD snippet: for / f "usebackq token = 1 -3 delim = /" %% d in ('% date%') (set day = %% D set months = %% e set year = %% F )

(Warning: Specific locale.)

Now you can type different log files as you see fit.

Comments