I seldom pay attention to basic file explorer actions, such as copying and moving files or folders. As long as the transfer completes without errors, I’m content with the results. Back in 2013, I used to install TeraCopy on every new Windows 7 or 8 installation. Still, I gradually stopped doing so as file transfers became more graphical and reliable with the newer Windows OS versions. However, Windows has had a built-in advanced copy tool for nearly three decades, which I’ve surprisingly overlooked in my last fifteen years of interaction with Windows computers.
Robocopy is a command-line tool that offers versatile file transfer capabilities and options that extend beyond File Explorer’s capabilities. I can ha…
I seldom pay attention to basic file explorer actions, such as copying and moving files or folders. As long as the transfer completes without errors, I’m content with the results. Back in 2013, I used to install TeraCopy on every new Windows 7 or 8 installation. Still, I gradually stopped doing so as file transfers became more graphical and reliable with the newer Windows OS versions. However, Windows has had a built-in advanced copy tool for nearly three decades, which I’ve surprisingly overlooked in my last fifteen years of interaction with Windows computers.
Robocopy is a command-line tool that offers versatile file transfer capabilities and options that extend beyond File Explorer’s capabilities. I can have granular control over what’s copied, what to include or ignore, how many retries I need, view logs, and even create automated file copy tasks. Let’s discuss why you should use Robocopy instead of the regular method, especially for huge file transfer sessions.
Why use Robocopy?
Multiple advantages
The obvious question is, why must you ditch the regular GUI method for transferring files and use Robocopy? Simply put, I’m in awe of the difference in speed. Robocopy instantly starts file transfer and doesn’t waste time counting all the files, unlike File Explorer. This proactive approach enables Robocopy to always have a lead over the GUI tool.
To test it, I ran multiple file transfer scenarios from my Windows PC to an external SATA SSD. I wanted to check the tool’s reliability while copying folders with thousands of files and sub-folders. So, I copied the Program Files (x86) folder from the C drive to the SSD via File Explorer’s built-in tool. It took 1 minute and 8 seconds to complete the operation.
I didn’t expect any wild results, to be honest, but Robocopy completed the same job in 58 seconds. That’s a ten-second difference for a 1.94GB folder with 1307 files. Next, I increased the pressure by copying my phone’s backup folder.
It was over 14GB, with more than 8,000 files, and Robocopy outperformed the GUI tool here too. File Explorer completed the job in 1 minute and 25 seconds, while Robocopy took only 1 minute and 5 seconds. The performance difference is so surprising that it feels like you’re deliberately enduring slow transfers.
Imagine copying a 100GB folder (a relatively common size by today’s standards and typical of huge game files) using the GUI tool and waiting longer than usual for the operation to complete. For small file transfers involving a limited number of files and directories, File Explorer performs well. However, for larger tasks, I would immediately switch to Robocopy.
More control over transfer
Multiple switches and options
A simple Robocopy command to copy the content of one folder to another looks like this:
robocopy "C:\vive" "C: \x" /E /L
In the above command, I specified the source and destination locations after typing robocopy. Following that is an /E flag, which instructs Robocopy to copy all sub-directories, including empty ones. If you don’t specify /E, it’ll only focus on files inside the folder but will ignore sub-folders and their contents. Since I run the commands in an elevated Terminal window, I don’t need to deal with prompts to allow admin permissions for some files.
/L is a cool flag to do a test run before the actual file copying starts. It gives you an idea about what it’ll copy, the flags it’ll use, and the file types. You’ll also notice that the tool includes some flags by default, which are for your benefit only. Even if you don’t add anything to it, it’ll include data (D), attributes (A), and timestamps (T) for all files, but skip timestamps for sub-folders. So, always add /DCOPY:DAT to ensure timestamps are copied as well.
The tool also adds the /R flag to specify the number of retries if the copy fails, and the /W flag to specify the wait time before attempting a retry.
robocopy "C:\vive" "C: \x" /E /DCOPY:DAT
The above-basic syntax will work for most file transfers, but if you want an accurate description of the transfer session, you can add the /V flag and specify a save location to create a log file. It’ll copy the complete console output and the list of skipped items to the file. It’s easier than checking the Event Viewer and scrolling through a huge list of entries.
Similarly, you can use the /MOVE flag with /COPY to cut-and-paste files from one location to another. Filtering options are also available, and by default, it copies every file inside a folder. However, you can choose to copy or move files with specific names or extensions instead of copying everything.
Robocopy offers support for paths longer than 256 characters by default, which means fewer problems after you’ve begun a copy implementation.
Automating file transfers
Robocopy jobs are magical
The idea of using a CLI tool and typing commands every time might sound like a chore, but Robocopy has a solution for that, too. You can create a Robocopy job file that can save you from retyping commands. When you run the command, just add the /SAVE:“save location” flag with the correct location where you want to save the job file.
robocopy "C:\vive" "C: \x" /E /SAVE:"c:\job"
Then, the tool creates an RCFfile that you can run from the command line. I find the job file helpful when I need to copy the changes from an existing location to a new directory. It detects the file and folder changes in the original directory and adds the new items. You can use the following syntax to run the job file from the terminal:
Robocopy /JOB:”location\jobfile.RCF”
It’ll include all the commands you specified in the previous run and basically serve as a one-line execution of an otherwise very long Robocopy command. But why restrict yourself to just one job file? You can create multiple job files and run transfers from multiple folder locations to an external drive.
The next obvious step is to create a batch file of one or more Robocopy jobs. While individual jobs are good enough, you can club them into a batch file (or even one job) and run them with administrator privileges. To automate the Robocopy batch script, I use Task Scheduler, which saves me the hassle of running a script manually.
As a small example, here’s a snippet of one command that copies my phone data to a folder:
robocopy "E:\S21 fe main\Android" "E: \y" /e /DCOPY: DAT /V /LOG:"c:\Log. txt"
Before automating this batch script, you must be wondering about the /V flag at the end, followed by a /LOG flag. These two flags create a log file of the console output in verbose mode, which is easy to read.
I did so because when you execute a batch file, it runs the Robocopy commands present inside and closes the Terminal window. You are unsure of the final status of the file transfer, including broken actions and skipped files. But instructing it to create a log file allows you to review everything after the session completes, even if the Terminal window closes automatically.
Just paste the commands in a Notepad file and save it as “xyx.bat” with the name and extension. The next phase is launching the Task Scheduler and creating a basic task, specifying the time and location of the script. I set it to daily so it can copy the new changes I make to the source directory and never have to run the batch file manually again.
No more file transfer woes
Robocopy is a lesser-known tool among the regular Windows user base, but it deserves every bit of your attention. You can schedule copy jobs, exclude files, mirror directories, and do many more actions that transcend File Explorer’s copy/move actions. It’s faster too, and even has a multithreaded option, but I found the normal one adequate. There are also some GitHub projects and a paid app on the Store if you need a GUI version of this fantastic tool.