So, you have a large batch of files and want to move or copy them reliably from one location to another. (this works for nearly all scenarios: local->local, local->network, ext hd->local, ext ht->network)
Microsoft TechNet reference for Robocopy
Helpful TechNet Magazine article on Robocopy and another
Download it here if you don’t already have it
All you have to know is this simple command:
robocopy [destination] –z –e
/Z :: copy files in restartable mode. This means if the command stops because the network is no longer available or some other reason… all you have to do is re-run the command and it’ll pickup where it left off.
/E :: copy subdirectories, including Empty ones. This will recreate the exact directory tree… so if you’re copying an entire tree (files and sub-directories) it will exactly recreate it even if there are no files inside of a folder.
This command also takes advantage of a few defaults:
/COPY: DAT :: what to COPY for files. This means the files that are copied, will also transfer over the data, attributes, as well as the timestamps like last modified, etc…
/R:n :: number of Retries on failed copies: default 1 million. This means if the command fails it will sit and retry up to a million times before failing. I rely on this since I usually run my command overnight. If the network goes down, it is probably do to a simple power issue. The hub will go down but the computers won’t due to my UPS’s. When power is restored and the hubs come backup, the copy will continue.
/W:n :: Wait time between retries: default is 30 seconds. If it fails as described previously, this is the timer which runs before retrying. Every 30 seconds upon a failure.
Robocopy is an essential command that everyone who uses computers should be aware of. Put this one in your pocket and pull it out when needed.
2 thoughts on “Robocopy’ing Basics”