Robocopy is Robust File Copy, a command-line tool built into Windows 10
- Run this
Command Prompt
with administrator rights. - Run this
.bat
script in command prompt like:
fastcopy "D:\folder" "D:\new_folder"
or for network files
fastcopy "\\10.1.2.111\folder" "D:\new_folder"
Robocopy has many features, and in the command shown in this guide, we’re using the following switches to make copy reliable and fast.
- /S — Copy subdirectories, but not empty ones.
- /E — Copy Subdirectories, including empty ones.
- /Z — Copy files in restartable mode.
- /ZB — Uses restartable mode. If access is denied, use backup mode.
- /R:5 — Retry 5 times (you can specify a different number, the default is 1 million).
- /W:5 — Wait 5 seconds before retrying (you can specify a different number, the default is 30 seconds).
- /TBD — Wait for share names To Be Defined (retry error 67).
- /NP — No Progress – don’t display percentage copied.
- /V — Produce verbose output, showing skipped files.
- /MT:32 — Do multi-threaded copies with n threads (default is 8).
The most important switch to focus on in the above command is /MT, which is the switch that enables Robocopy to copy files in multi-threaded mode. If you do not set a number next to the /MT switch, the default number will be 8, which means that Robocopy will try to copy eight files simultaneously. However, Robocopy supports 1 to 128 threads.
In this command, we are using 32, but you can set it to a higher number. The only caveat is that using a higher number will cause higher resource usage and bandwidth. If you have an older processor, using a high number will affect performance. As a result, make sure to test before executing the command with a high number of threads.
You are not limited to copying files and folders to an external or internal drive, and this also works to migrate files over the network.
Sources:
How fast delete many files in Windows with
ropocopy
?https://tylermade.net/2017/10/06/how-to-delete-all-files-in-a-directory-with-robocopy/