Posted by: Raj Perumal
IT consultant, Robocopy, Server migration
During server migrations, it often comes up on what is a good way to migrate files from point A to point B. I often see very experienced network administrators using drag and drop file copy and sitting there monitoring the file copy of gigabytes of data. This usually isn’t a good way to do things because it’s slow and prone to failure when copying large amounts of data. There are many utilities out there you can use but my personal favourite is Microsoft’s own Robocopy. Robocopy is a single executable file available to you from the Windows Resource kit but is now also available through Windows Vista and Windows 2008.
Using robocopy you can easily script a copy of a source folder to a target folder and then log the results to a file. Then you can also tell it to copy all changes made at the source location to the target location every “n” amount of changes. Effectively mirroring the source to the target. The thing to keep in mind here is to always ensure your target is not a root drive letter if it’s on an existing volume because this will erase the files at the target location and then mirror the source. Instead it is better to create a target folder and mirror your files into there, that way there is no risk to you deleting files accidently.
After the robocopy is run you can look through the log and see which files have been copied and which ones weren’t and then tend to those files/folders individually on a case by case basis. This usually happens if a file is locked by another user or process or if the user you are running robocopy as does not have permission to the files or folders.
Robocopy is great because it does not crash during copy and it copies extremely fast as compared to the normal drag and drop method. You can script the copy and then just run it and walk away and come back the next day.