Robocopy question

Thomas N
Thomas N used Ask the Experts™
on
Im running this robocopy command and I want to make sure it just copies the files over and keeps the files in both location. Is the command below okay? Also is there any switch that would delete the original location?

C:\>robocopy \\server1  \\server2 *.* /E /MIR /SEC /R:0 /W:1 /COPY:DATSO /LOG:c:\roboc
opy.log
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
NVITEnd-user support

Commented:
> ... switch that would delete the original location
Use /MOVE to move files and dirs (delete from source after copying)

Also use /DCOPY:T to copy Directory Timestamps. Else it will have the current time

Good info here...
http://ss64.com/nt/robocopy.html
Thomas NSystems Analyst - Windows System Administrator

Author

Commented:
So the command I have above should be okay right? It should keep at both locations? Thanks
NVITEnd-user support

Commented:
/MIR copies (mirrors) the source. So, Yes... A copy at both locations. Don't forget the /DCOPY:T switch, too.

To gain confidence, try the command on a test folder. It doesn't have to be lots of files. Just include some folders, too.
I would leave out parameter  /SEC  as this would imply /COPY:DATS
This because you are already specifying  /COPY:DATSO
You could also leave out parameter  /E  as /MIR already includes this option
Also include the no progress switch /NP as otherwise your logging will contain the progress info.
You could leave out *.* also as this is the default.
If you like to append an existing logfile then just change /LOG: to /LOG+:c:\robocopy.log

An example:
robocopy "\\server1\share" "\\server2\share" /MIR /NP /R:0 /W:1 /COPY:DATSO /DCOPY:T /LOG+:c:\robocopy.log

Open in new window


Also keep in mind that the robocopy versions that come with the OS can have problems with copying NTFS permissions.
So please check if the NTFS security is copied over correctly.

If it won't copy the NTFS security then please use the older robocopy XP010 version which can be extracted from the Windows Server 2003 Resource Kit Tools
https://www.microsoft.com/en-us/download/details.aspx?id=17657
I would not install the software but just unpacking the files.
Unpack rktools.exe with e.g. 7-Zip
Unpack rktools.msi and copy "robocopy.exe" to the directory where you want to run the script.
The /DCOPY:T switch is not supported with this older version.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial