From: JohnB on 17 Jun 2010 08:32 I've always used xcopy in the past, but recently decided I need to become familiar with RoboCopy. I found a sample batch file to back up folder(s) to an external drive. Modified it a little. And it does just what I need. When run manually it creates a log file with this command: SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log But I'm running it from Task Scheduler. It ran fine last night, the first time it was run. Everything backed up. But, no log file was created. How could running it from the scheduler affect that?
From: Pegasus [MVP] on 17 Jun 2010 12:42 "JohnB" <jbrigan(a)yahoo.com> wrote in message news:OV814khDLHA.5436(a)TK2MSFTNGP04.phx.gbl... > I've always used xcopy in the past, but recently decided I need to become > familiar with RoboCopy. I found a sample batch file to back up folder(s) > to an external drive. Modified it a little. And it does just what I > need. When run manually it creates a log file with this command: > SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log > > But I'm running it from Task Scheduler. It ran fine last night, the first > time it was run. Everything backed up. But, no log file was created. > How could running it from the scheduler affect that? Can't tell without knowing the value of %prefix%. Anyway, you can easily find out yourself by logging what's going on, e.g. like so: @echo off echo %date% %time% log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log>>c:\problem.txt It would also help if you posted your whole robocopy command line.
From: JohnB on 17 Jun 2010 12:51 This is the entire script: --------------------------- @Echo off REM Backup user files to external drive REM. REM. SET prefix=robocopy_backup SET source_dir="E:\users" SET dest_dir="H:\BD_Users_Backup" REM. REM. REM Set the log file name based on the current date. This REM will record the results from the robocopy command. REM The typical format for the date command is: REM Mon 11/09/2000 SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log SET what_to_copy=/COPY:DAT /MIR REM Exclude some files and directories that include transient data REM that doesn't need to be copied. SET exclude_dirs=/XD "Temporary Internet Files" "Cache" "Recent" "Cookies" "iPod Photo Cache" "MachineKeys" SET exclude_files=/XF *.bak *.tmp index.dat usrclass.dat* ntuser.dat* *.lock *.swp SET options=/R:0 /W:0 /LOG+:%log_fname% /NFL /NDL ROBOCOPY %source_dir% %dest_dir% %what_to_copy% %options% %exclude_dirs% %exclude_files% :END --------------------------- But what is odd is, it creates the log file when run manually. It does not when run from scheduler. This is on Sever 2008 standard. "Pegasus [MVP]" <news(a)microsoft.com> wrote in message news:uvn2gwjDLHA.1888(a)TK2MSFTNGP05.phx.gbl... > > > "JohnB" <jbrigan(a)yahoo.com> wrote in message > news:OV814khDLHA.5436(a)TK2MSFTNGP04.phx.gbl... >> I've always used xcopy in the past, but recently decided I need to become >> familiar with RoboCopy. I found a sample batch file to back up folder(s) >> to an external drive. Modified it a little. And it does just what I >> need. When run manually it creates a log file with this command: >> SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log >> >> But I'm running it from Task Scheduler. It ran fine last night, the >> first time it was run. Everything backed up. But, no log file was >> created. >> How could running it from the scheduler affect that? > > Can't tell without knowing the value of %prefix%. Anyway, you can easily > find out yourself by logging what's going on, e.g. like so: > @echo off > echo %date% %time% > log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log>>c:\problem.txt > > It would also help if you posted your whole robocopy command line.
From: Pegasus [MVP] on 17 Jun 2010 14:22 I modified your last line to echo ROBOCOPY %source_dir% %dest_dir% %what_to_copy% %options% %exclude_dirs% %exclude_files% then ran the batch file and examined its output. It works perfectly well in every regard but since you did not specify a drive or folder for your log file it ended up who knows where but certainly not where you expected it. In batch files it is compulsory to fully qualify all file names. Chances are you can find the log file in the System32 folder. "JohnB" <jbrigan(a)yahoo.com> wrote in message news:eaJMF1jDLHA.3776(a)TK2MSFTNGP04.phx.gbl... > This is the entire script: > > --------------------------- > @Echo off > REM Backup user files to external drive > REM. > REM. > SET prefix=robocopy_backup > SET source_dir="E:\users" > SET dest_dir="H:\BD_Users_Backup" > REM. > REM. > REM Set the log file name based on the current date. This > REM will record the results from the robocopy command. > REM The typical format for the date command is: > REM Mon 11/09/2000 > SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log > SET what_to_copy=/COPY:DAT /MIR > REM Exclude some files and directories that include transient data > REM that doesn't need to be copied. > SET exclude_dirs=/XD "Temporary Internet Files" "Cache" "Recent" "Cookies" > "iPod Photo Cache" "MachineKeys" > SET exclude_files=/XF *.bak *.tmp index.dat usrclass.dat* ntuser.dat* > *.lock *.swp > SET options=/R:0 /W:0 /LOG+:%log_fname% /NFL /NDL > ROBOCOPY %source_dir% %dest_dir% %what_to_copy% %options% %exclude_dirs% > %exclude_files% > > :END > --------------------------- > > But what is odd is, it creates the log file when run manually. It does > not when run from scheduler. This is on Sever 2008 standard. > > > > > > "Pegasus [MVP]" <news(a)microsoft.com> wrote in message > news:uvn2gwjDLHA.1888(a)TK2MSFTNGP05.phx.gbl... >> >> >> "JohnB" <jbrigan(a)yahoo.com> wrote in message >> news:OV814khDLHA.5436(a)TK2MSFTNGP04.phx.gbl... >>> I've always used xcopy in the past, but recently decided I need to >>> become familiar with RoboCopy. I found a sample batch file to back up >>> folder(s) to an external drive. Modified it a little. And it does just >>> what I need. When run manually it creates a log file with this command: >>> SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log >>> >>> But I'm running it from Task Scheduler. It ran fine last night, the >>> first time it was run. Everything backed up. But, no log file was >>> created. >>> How could running it from the scheduler affect that? >> >> Can't tell without knowing the value of %prefix%. Anyway, you can easily >> find out yourself by logging what's going on, e.g. like so: >> @echo off >> echo %date% %time% >> log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log>>c:\problem.txt >> >> It would also help if you posted your whole robocopy command line. > >
From: JohnB on 17 Jun 2010 15:40 > you can find the log file in the System32 folder. You're exacty right, that's where it was. I'd like to add this line: SET Log_Path="C:\Scripts" And then modify the "set options" line. How would that work, like this: SET options=/R:0 /W:0 /LOG+:%Log_Path%+%log_fname% /NFL /NDL or this: SET options=/R:0 /W:0 /LOG+:%Log_Path%, %log_fname% /NFL /NDL or this: SET options=/R:0 /W:0 /LOG+:%Log_Path% %log_fname% /NFL /NDL With the separator being a plus sign, comma or space? "Pegasus [MVP]" <news(a)microsoft.com> wrote in message news:uCTkKokDLHA.4256(a)TK2MSFTNGP06.phx.gbl... >I modified your last line to > > echo ROBOCOPY %source_dir% %dest_dir% %what_to_copy% %options% > %exclude_dirs% %exclude_files% > > then ran the batch file and examined its output. It works perfectly well > in every regard but since you did not specify a drive or folder for your > log file it ended up who knows where but certainly not where you expected > it. In batch files it is compulsory to fully qualify all file names. > Chances are you can find the log file in the System32 folder. > > "JohnB" <jbrigan(a)yahoo.com> wrote in message > news:eaJMF1jDLHA.3776(a)TK2MSFTNGP04.phx.gbl... >> This is the entire script: >> >> --------------------------- >> @Echo off >> REM Backup user files to external drive >> REM. >> REM. >> SET prefix=robocopy_backup >> SET source_dir="E:\users" >> SET dest_dir="H:\BD_Users_Backup" >> REM. >> REM. >> REM Set the log file name based on the current date. This >> REM will record the results from the robocopy command. >> REM The typical format for the date command is: >> REM Mon 11/09/2000 >> SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log >> SET what_to_copy=/COPY:DAT /MIR >> REM Exclude some files and directories that include transient data >> REM that doesn't need to be copied. >> SET exclude_dirs=/XD "Temporary Internet Files" "Cache" "Recent" >> "Cookies" "iPod Photo Cache" "MachineKeys" >> SET exclude_files=/XF *.bak *.tmp index.dat usrclass.dat* ntuser.dat* >> *.lock *.swp >> SET options=/R:0 /W:0 /LOG+:%log_fname% /NFL /NDL >> ROBOCOPY %source_dir% %dest_dir% %what_to_copy% %options% %exclude_dirs% >> %exclude_files% >> >> :END >> --------------------------- >> >> But what is odd is, it creates the log file when run manually. It does >> not when run from scheduler. This is on Sever 2008 standard. >> >> >> >> >> >> "Pegasus [MVP]" <news(a)microsoft.com> wrote in message >> news:uvn2gwjDLHA.1888(a)TK2MSFTNGP05.phx.gbl... >>> >>> >>> "JohnB" <jbrigan(a)yahoo.com> wrote in message >>> news:OV814khDLHA.5436(a)TK2MSFTNGP04.phx.gbl... >>>> I've always used xcopy in the past, but recently decided I need to >>>> become familiar with RoboCopy. I found a sample batch file to back up >>>> folder(s) to an external drive. Modified it a little. And it does >>>> just what I need. When run manually it creates a log file with this >>>> command: >>>> SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log >>>> >>>> But I'm running it from Task Scheduler. It ran fine last night, the >>>> first time it was run. Everything backed up. But, no log file was >>>> created. >>>> How could running it from the scheduler affect that? >>> >>> Can't tell without knowing the value of %prefix%. Anyway, you can easily >>> find out yourself by logging what's going on, e.g. like so: >>> @echo off >>> echo %date% %time% >>> log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log>>c:\problem.txt >>> >>> It would also help if you posted your whole robocopy command line. >> >>
|
Next
|
Last
Pages: 1 2 Prev: HMS Host activation on w2k3 R2 Next: Error while backup System State via Windows Server Backup |