You are not logged in.

#1 21 May 2015 19:42

athomas13
Member
Registered: 21 May 2015
Posts: 3

Using Robocopy and failing to created a log file.

I am trying to create a log file each day but the process errors out.  Here is the short copy of the file.

@echo on
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set year=%%c
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set month=%%a
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set day=%%b

REM ** Year= %year% Month= %month% Day= %day% **
Timeout 20
mkdir c:\delete
dir c:\delete
Timeout 20
c:\windows\system32\robocopy.exe "C:\microsoft sql server" "c:\Delete" /e /MOV /MINAGE:2 /LOG:C:\%month%-%day%.log\
timeout 35
dir c:\delete
timeout 35
rmdir c:\delete /s /q
dir C:\microsoft sql server

Can anyone tell me what I am doing wrong?

Offline

#2 21 May 2015 19:50

Simon Sheppard
Admin
Registered: 27 Aug 2005
Posts: 1,130
Website

Re: Using Robocopy and failing to created a log file.

Writing a log file to the root of the C: drive is verboten, try putting it into C:\Logs\%month%-%day%.log

Offline

#3 21 May 2015 21:09

athomas13
Member
Registered: 21 May 2015
Posts: 3

Re: Using Robocopy and failing to created a log file.

I revised the location of the logs but it still comes up with the following error: 

ERROR : Invalid parameter #6  : "/Logs\05-21.log"

Offline

#4 21 May 2015 21:50

athomas13
Member
Registered: 21 May 2015
Posts: 3

Re: Using Robocopy and failing to created a log file.

I created the C:\logs directory and modified the command line to be as follows:

c:\windows\system32\robocopy.exe "C:\microsoft sql server" "c:\Delete" /e /MOV /MINAGE:2 /LOG:"C:\Logs\robocopy-%month%_%day%.log"

It will work now.

Offline

Board footer

Powered by