Windows Server 2003
1821985 Members
3433 Online
109638 Solutions
New Discussion юеВ

Robocopy create 2 logs

 
Roger Griffiths
Occasional Contributor

Robocopy create 2 logs

Hi,

I want to create two log files for each job executed in a Robocopy batchfile each night of the week. One will be appended with each nights progress output using the /LOG+: switch and thus continually grow a full history of backup copies. The other will also produce a log with the same activity but will erase the previous nights content of the file using the /LOG: switch.

So my command line entry looks like this:
Robocopy %SOURCE1%\ %DEST1% /NP /IF *-cd* *-cw* *-cm* *.spf* /MAXAGE:2 /S /ZB /LOG+:spcopylog.txt /Log:2dayslog.txt

What I get using the syntax above is a fully appended log (which I want) but the second log just has the path to itself as the content.

I want to use vmail to email me the 2dayslog content which it does but as stated the log itself is devoid of the actual work done by Robocopy.

Thanks in advance...

Roger
3 REPLIES 3
Jon Finley
Honored Contributor

Re: Robocopy create 2 logs

I think that you can only do one log file.

But, try adding in the /TEE switch. You "may" be able to then redirect to an additional output file.

Robocopy %SOURCE1%\ %DEST1% /NP /IF *-cd* *-cw* *-cm* *.spf* /MAXAGE:2 /S /ZB /LOG+:spcopylog.txt /TEE >2dayslog.txt

Jon
"Do or do not. There is no try!" - Yoda
Roger Griffiths
Occasional Contributor

Re: Robocopy create 2 logs

Thanks. I found an alternate way...

Robocopy %SOURCE1%\ %DEST1% /NP /IF *-cd* *-cw* *-cm* *.spf* /MAXAGE:2 /S /ZB /LOG:2daylog.txt
Robocopy %SOURCE2%\ %DEST2% /NP /IF *-cd* *-cw* *-cm* *.spf* /MAXAGE:2 /S /ZB /LOG+:2daylog.txt

Then...

:: Prepare logs for emailing
::
Echo Today's backup report: > spinctail.txt
::
:: Add the content for the email header i.e. to, from subject, beginning message to the out going message
::
Type Header.txt >> spinctail.txt
::
:: Add the contents of today's backup log to the email message
::
Type 2daylog.txt >> spinctail.txt
::
:: Use vmail to send the prepared email. Format must include Executable - Filename - mail server - recipient email - sender email
::
VMAILER.EXE spinctail.txt myserver.mydomainname.co.nz itadministrators@mydomainname.co.nz SPBackup@mydomainname.co.nz
::
:: Append the master log (spcopylog.txt) with today's backup log
::
TYPE 2daylog.txt >> spcopylog.txt

...so the master log being spcopylog.txt is appended each day from the 2daylog.txt capture. Works great too...

Thanks for responding.
Edgar Zapata
Esteemed Contributor

Re: Robocopy create 2 logs

Hi,

Just so you know.
Chances are you can't do 2 different logs with Robocopy by itself.
I know you're using Robocopy command line tool, but look at the Robocopy GUI 3.1.
There's only 1 field for log path, regardless of whether you use /LOG: or /LOG+:

Regards.