Skip to Content

Solved: What is the Robocopy command to copy all files and folders?

Question / Problem

What is the robocopy command to copy all files, folders, and subfolders including long file names from this path C:\Users\User1\Folder1 to E:

Answer / Solution

Robocopy command is a very good tool for migration or to synchronizing to server/folder at the same state.

Robocopy command supports long file names since NT4.0. Robocopy command will by default skip the copying of files that already exist in the same version in the target (same timestamp, same size), so you can just re-run the copy, and it will only copy the differences.

Most basic command, assuming you want the results to end up in Folder1 as well, not in the root of E:

robocopy.exe C:\Users\User1\Folder1 E:\Folder1 *.* /e /r:0

That would be the /log parameter; when logging to a file, you should also add /np (“no progress”), because the progress display uses control characters that make the log hard to read. And when enabling logging, console output will by default be disabled, but you can add /tee to show the console output while logging:

robocopy.exe C:\Users\User1\Folder1 E:\Folder1 *.* /e /r:0 /tee /np /log:"C:\C:\Users\User1\roboopy.log"

Two minor changes I’d suggest:

  • add /dcopy:dat to include the original date and time on folders.
  • If you change /log: to /log+: it will not overwrite the old log file. Set it whichever way you prefer.

Maybe you should set also the parameter /W for the wait time in case of network problems couple with the /R you already use. You can set this parameter in the registry ONE TIME if you use the same script longtime with /REG.

The solution steps outlined above may be used to address the following issues:

  • How to use robocopy to copy all files and folders
  • Robocopy command syntax for copying all files and folders
  • Copying entire directory structures with robocopy
  • Robocopy switches for copying all files and directories
  • Efficiently copying all files and folders with robocopy
  • Robocopy options for recursive file and folder copying
  • Robocopy batch file for copying all files and folders
  • Maximizing robocopy performance for copying all files and folders
  • Robocopy command line examples for copying all files and folders
  • Automating file and folder copying with robocopy