novanation
asked on
RoboCopy Script
Does anyone know how to create a scheduled RoboCopy task to back up the contents of one disk to another? I would be looking for it to run nightly and only copy new or changed files. Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here are a few examples that will get you started.
http://robocopylogscanner.com/faq/robocopy-script-example
http://serverfault.com/questions/46729/where-can-i-find-ready-to-use-windows-scripts-that-used-robocopy
http://robocopylogscanner.com/faq/robocopy-script-example
http://serverfault.com/questions/46729/where-can-i-find-ready-to-use-windows-scripts-that-used-robocopy
you could write it as a batch file however you could also call robocopy as a scheduled task w/o it being a batch file.
You simply need to ensure the account calling the task has the require R/W permissions.
You simply need to ensure the account calling the task has the require R/W permissions.
ASKER
Is there a way for it to generate a log file or some type of report in case files were skipped?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
rem
rem Work kopieren
rem
Resource Kit oder nur als exe
rem 13.06.2008 ms
rem set StartPath=%~d0%~p0
set FileHome=\\srv3\work
set SIScript=D:\Server\Admin\S cript
set SILog=D:\Server\Admin\Log
set FileBack=D:\work
echo "%FileHome%" "%FileBack%" /SEC /MIR /COPYALL /R:1 /W:2 /NP /NDL /Log:"%SIScript%\WorkCopy. log"
pause Kopieren ausfuehren?
robocopy "%FileHome%" "%FileBack%" /SEC /MIR /COPYALL /R:1 /W:2 /NP /NDL /Log:"%SIScript%\WorkCopy. log"
rem Copy Logs
set TimeStamp=%date:~-4%%date: ~3,2%%date :~0,2%_%ti me:~0,2%%t ime:~3,2%% time:~6,2% %time:~9,2 %
rem remove spaces (better for filenames ...)
SET TimeStamp=%TimeStamp: =0%
copy "%SIScript%\WorkCopy.log" "%SILog%\WorkCopy_%TimeSta mp%.log"
rem Work kopieren
rem
Resource Kit oder nur als exe
rem 13.06.2008 ms
rem set StartPath=%~d0%~p0
set FileHome=\\srv3\work
set SIScript=D:\Server\Admin\S
set SILog=D:\Server\Admin\Log
set FileBack=D:\work
echo "%FileHome%" "%FileBack%" /SEC /MIR /COPYALL /R:1 /W:2 /NP /NDL /Log:"%SIScript%\WorkCopy.
pause Kopieren ausfuehren?
robocopy "%FileHome%" "%FileBack%" /SEC /MIR /COPYALL /R:1 /W:2 /NP /NDL /Log:"%SIScript%\WorkCopy.
rem Copy Logs
set TimeStamp=%date:~-4%%date:
rem remove spaces (better for filenames ...)
SET TimeStamp=%TimeStamp: =0%
copy "%SIScript%\WorkCopy.log" "%SILog%\WorkCopy_%TimeSta
Depending on whether this is a backup script, using the /MIR switch enables mirroring so if any files are deleted from the source then it will also be deleted from the destination.
So unless you have a backup of the backup, you'll not be able to restore files after an accidental delete.
But if you're looking for folder synchronization the use the /MIR switch.
So unless you have a backup of the backup, you'll not be able to restore files after an accidental delete.
But if you're looking for folder synchronization the use the /MIR switch.
ASKER