How to use robocopy

To copy a folder from one network drive to another using the Command Prompt (cmd), you can use the robocopy command, which is a robust file copy command for the Windows command line.

Here's a general example of how you might use robocopy to copy a folder between network drives:

robocopy "\\SourceNetworkDrive\path\to\sourceFolder" "\\DestinationNetworkDrive\path\to\destinationFolder" /E

Explanation:

  • \\SourceNetworkDrive\path\to\sourceFolder is the UNC path to the source folder on the first network drive.

  • \\DestinationNetworkDrive\path\to\destinationFolder is the UNC path where you want the folder to be copied to on the second network drive.

  • /E is a switch to copy subdirectories, including empty ones.

Note: Make sure you have the necessary permissions to read from the source location and write to the destination location.

A few other commonly used robocopy switches you might find useful:

  • /Z: Copy files in restartable mode (useful for large files or unreliable network connections).

  • /R:n: Specifies the number of retries on failed copies (default is a million, so you might want to set it lower, e.g., /R:5).

  • /W:n: Specifies the wait time between retries (default is 30 seconds).

For example, if you wanted to use these additional switches, your command might look like this:

robocopy "\\SourceNetworkDrive\path\to\sourceFolder" "\\DestinationNetworkDrive\path\to\destinationFolder" /E /Z /R:5 /W:10

Always be sure to check the robocopy documentation or run robocopy /? in the command prompt to see a full list of options and their explanations.

Advantage

Using robocopy in the Command Prompt (CMD) versus the graphical user interface (GUI) method (like using File Explorer drag-and-drop) has advantages and potential speed benefits, although the actual speed may vary depending on the specific circumstances. Here are the reasons you might find robocopy to be faster or more efficient than the GUI copy method:

  1. Robustness: robocopy can handle network interruptions better. If a copy process is interrupted, robocopy can resume from where it left off, especially with the /Z (restartable mode) option. In contrast, GUI copy might require starting the copy process over from the beginning.

  2. Bulk Operations: robocopy is excellent for large-scale operations. If you're moving thousands of files and folders, the CMD method might handle this bulk operation more efficiently than the GUI.

  3. Fewer Overheads: robocopy is a command-line tool, and it doesn't have the overhead of updating the GUI (graphics) every time a file is copied or moved, which can add some delay, especially with a large number of files.

  4. Parallel Copying: robocopy has an option /MT that allows for multi-threaded copies. This can speed up the copy process, especially for a large number of small files. The GUI does not typically employ multi-threaded copying.

  5. Better Feedback: With robocopy, you can get a detailed log of what is being copied, what failed, and why it failed, which is more detailed than the generic error messages you might get from the GUI.

  6. Advanced Filtering: You can set specific filters with robocopy to include or exclude files or folders based on a variety of criteria, which can make the copy process faster if you don't need to copy everything.

  7. Less User Interaction: With GUI, you might come across prompts asking you what to do if a file already exists in the destination, or if there's a conflict. While these can be managed with settings, it's generally more straightforward with robocopy, especially if you're setting it up for automation.

That being said, the speed benefit of robocopy might not be noticeable for small copy jobs or in situations where network speed is the limiting factor. For daily, small tasks, the GUI might feel more convenient for many users. However, for large-scale operations, especially over potentially unstable network connections, robocopy is likely the better choice.