It’s time for another TDSheridanLab Quick Tip!
We all have to copy large amounts of data at some time or another. Whether it’s because we bought a new computer or because we’re doing a migration. Either way one of the simplest ways to do and retain file/folder attributes is RoboCopy. RoboCopy has been around since Windows 2000 and is built into every version of Windows since. Robocopy is an extremely granular tool but once you have the base command you’ll use it for all of your migrations. The example command below is a basic command that will copy the source file structure including, file and folder attributes to a new location while writing the transfer to a log and outputting the status to the command prompt window.
In an Administrative Command Prompt Window: robocopy [source] [destination] [switches] Example: robocopy C:\Users\Terry\Downloads\ C:\Users\Terry\Documents\Test\ /COPYALL /s /e /r:0 /Log:C:\CopyLog.txt /tee /COPYALL - Copies all security and file attributes /S - copies all subdirectories /E - copies all subdirectories even if they are empty /R - If a file is locked this specifies how many times robocopy will attempt to copy it before it skips it /Log - specifies a log file location /tee - writes the output to the screen
In the picture below you’ll see the output of how it works. I copied some test files from my “Downloads” folder to a “Test” folder in my “Documents” folder. As with any command prompt program remember to use quotation marks if your source and/or destination has any spaces in the path. I recommend typing out the command in notepad first, then copying it into the command prompt so you can double check all of the switches before you start copying data. Below the picture is a link to the full TechNet Article that shows all the copy options for RoboCopy.
I hope RoboCopy helps you with your next migration.