loading...

Robocopy Intro

taijidude profile image taijidude ・1 min read

I recently had to copy a lot of files and in another case a huge file (8GB database dump). As i work on a windows machine i used a nice command line tool called robocopy. Every windows comes with robocopy and it has, even with the default parameters, a better performance than the copy function in the explorer. So how does it work?

  • This how you list all possible parameters.
robocopy \?
Enter fullscreen mode Exit fullscreen mode
  • This copies the contents of the first folder into the second one. So far not surprising.
robocopy c:\test f:\test 
Enter fullscreen mode Exit fullscreen mode
  • This will keep the first folder with second folder synchronized. So only files will be copied that were added or changed in the first folder since the command was run last.
robocopy c:\test f:\test /MIR
Enter fullscreen mode Exit fullscreen mode
  • If you just want to copy a single file you type something like this:
robocopy c:\test f:\test testfile.txt
Enter fullscreen mode Exit fullscreen mode
  • By default robocopy uses just one thread when copying. But if you have a lot of files to copy, you can use the parameter /mt:[number]. This allows robocopy to use more threads and copy multiple files at once.
robocopy c:\test f:\test /mt:4
Enter fullscreen mode Exit fullscreen mode

Discussion

pic
Editor guide