DEV Community

taijidude
taijidude

Posted on • Edited on

Robocopy Intro

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
  • If you want to skip empty folders while copying use the /S Flag.
robocopy c:\test f:\test /S
Enter fullscreen mode Exit fullscreen mode

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more