How to Use RoboCopy to Backup Data
CHUONG K. NGUYEN – BSc., MCSEx2, MCSAx2, MCP, MCTS, MCITP, CCNA
RoboCopy is a built-in Windows application that can be used to copy data from a source location to a destination location.
I used the following Robocopy command to copy data from a shared directory called SOURCE on SOURCE-SRV to the destination folder called DESTINATION on the current server. All security permissions are kept intact.
E:\>robocopy \\SOURCE-SRV\SOURCE E:\DESTINATION /E /ZB /DCOPY:T /COPYALL /R:1 /W:1 /V /TEE /LOG:robocopy_archive.Log
Note that this assumes the current server has access to the source server. Please refer to the RoboCopy documentation for the switch usages.
For example:
if exist Z: net use Z: /delete net use Z: \\DESTTINATIONSERVER\SHARED Passw0rd! /user:username /persistent:y robocopy E:\SOURCEDIR Z:\DESTDIR /E /ZB /DCOPY:T /R:1 /W:1 /V /TEE /LOG:Robocopy_SOURCEDIR.Log
The log file robocopy_archive.log is stored in the current directory which is the E: drive.
Example 2: This example will cut out the log and eliminate some status display, creating the effect of a quiet mode.
@ECHO OFF if exist Z: net use Z: /delete /y net use Z: \\DESTINATIONSERVER\SHARED Passw0rd! /user:username /persistent:y robocopy E:\SOURCEDIR Z:\DESTDIR /njh /njs /ndl /nc /ns /E /ZB /DCOPY:T /R:1 /W:1 /V /TEE