How to copy copious amounts of data seamlessly

At one point in time, I found myself needing to move data from one server to a new server. Often times this happens when replacing a server.  So the server had about a terabyte of data on it. Pretty small, considering. But there were hundreds of thousands of files and folders.

I could just copy this data using Windows Explorer, but that isn’t as fun!  I set out to build a script to copy this data and I used Windows built in utility called Robocopy.

This utility is epic. There are so many things you can do with it. I’m going to highlight just a few for you.

Copy all data subdirectories and all files

robocopy.exe <source> <destination> /mir

Copy data over a network connection

To copy data over a network connection, sometimes the connection gets interrupted, the robocopy tool can automatically retry using the following command:

robocopy.exe <source> <destination> /mir /r:[number of times to retry]

Copy data with all NTFS ACLs and Owner Information

robocopy.exe <source> <destination> /copy:DATSOU

Copy data while deleting directories in destination that do not exist in source

robocopy.exe <source> <destination> /purge

Copy data while capturing a log file

robocopy.exe <source> <destination> /mir /log:<path>

Copy data while appending to a log file

robocopy.exe <source> <destination> /mir /log+:<path>


Stay tuned, I’ll had more functionalities here as I use more of them!