Using Robocopy to Transfer Files

Robocopy is a great utility that comes with Windows Vista, Windows 7, & Windows Server 2008 and is downloadable for Windows XP/2003. As it’s name suggests, it is a copy command but does a ton more than the DOS Copy or Xcopy commands.

We have used it in our environment to facilitate the migration from Novell File Servers to Windows File Servers and from Windows to Windows transfers. It’s best feature is the ability to copy the permissions along with the file. One thing to note, however, is that this feature does not work with Novell to Windows transfers, and the appropriate Windows permissions will need to be applied once the transfer is complete.

Robocopy also has the capability of removing the source files once they have been copied. I personally do not care for this particular feature in the event something were to go wrong, the source would be gone.

I created a small batch file that will map the network drives and perform the copy with the settings we would like configured. It will also output the results of the transfer to a log file .

rem Configure these two settings with desired share locations
SET _Ndrive=\\SourceServer\Share
SET _Vdrive=\\DestinationServer\Share
rem If you modify, leave /LOG: as is, only changing the path
SET _LogTxt=/LOG:C:\Robocopy\Results_Log.txt

NET USE N: /delete
ECHO Mapping %_Ndrive%...
NET USE N: %_Ndrive%

NET USE V: /delete
ECHO Mapping %_Vdrive%...
NET USE V: %_Vdrive%

ECHO.
SET _source=N:\
SET _destin=V:\

rem ***********************************ROBOCOPY**********************************

ROBOCOPY %_source% %_destin% /E /COPY:DATSOU /DCOPY:T /TS /NFL /TEE %_LogTxt%

rem /E Copy Subfolders, including Empty Subfolders.
rem /COPY:DATSOU
rem D=Data
rem A=Attributes
rem T=Timestamps
rem O=Owner info
rem U=aUditing info
rem /DCOPY:T Directory Copy
rem /TS Include Source file Time Stamps in the output.
rem /NFL No File List - don't log file names.
rem /TEE Output to console window, as well as the log file.
rem /LOG:file Output status to LOG file (overwrite existing log).

Advertisements
This entry was posted in Windows Server and tagged , . Bookmark the permalink.

2 Responses to Using Robocopy to Transfer Files

  1. Pingback: The Requested Operation Could Not Be Run on the Server « MyWinSysAdm

  2. R says:

    Very slick! Small note: must be elevated command prompt (right click on cmd.exe, and run as administrator).
    I am using this to copy 32Gb SD card from android 6.0 to larger 64Gb card. Although SD was originally formatted as portable storage and XCOPY would probably work, this might be very useful for users who formatted SD card as internal storage.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s