How to use Robocopy to quickly recover and skip files with errors from bad hard drive in Windows

Robocopy, copy utility for Windows

When a hard drive starts having problems and data corruption appears, we quickly get a new replacement, reinstall Windows, and hope that reconnecting the failing drive and using the typical “cut and paste” strategy will be enough to move our personal files to the new drive, but you’ll find out that it isn’t true.

The problem is that when the hard drive has issues reading and writing, data corruption, or other physical problems, using Windows’ cut and paste may not be the best solution, as it could take hours and even days to skip files with errors, or it may not even work at all.

This is when Robocopy can help out. Robocopy, short for “Robust File Copy”, is a command-line copy utility within Windows 8, Windows 8.1, Windows 7, and Windows Vista, more powerful than the “cut and paste” functionality we’re used to and even more than many other utilities you may find on the internet.

Robocopy can be your best shot to recover files from the dying hard drive because it’s easy to use, it can be easily configured to quickly skip unrecoverable files with errors, it’s more efficient, it copies absolutely everything withing a drive, it can resume from a lost connections if you’re moving files to a shared folder in the network, and just because the utility works better.

How to use Robocopy

If you’re trying to recover files from a failing hard drive, get a replacement, then reconnect the bad drive, launch the command prompt in Windows as administrator, and use the following command-line:

robocopy E:\source-path\folder\ C:\destination-path\folder /MIR /R:0 /W:0

Explanation: robocopy [source] [destination] [options]

As you can see with a very simple command we are making sure to copy files from the source drive (bad) to the new one, but we’re also using the /MIR switch that makes the copy a mirror copy, keeping the file structure between source and destination. Then we use /R:0 to limit retries to none and the /W:0 to no wait any time while copying. These switches will make sure corrupted or files with errors are skipped quickly, therefore making the recovery faster.

If you’re trying to copy a folder, which has a name with space (e.g., Summer Pictures), you’ll get an “Invalid parameter” error. To avoid errors with file name with spaces refer to the following command-line:

robocopy "E:\source-path\name with space" "C:\destination-path\new folder destination" /MIR /R:0 /W:0

Also you may also find a problem, if you’re trying to copy the built-in Windows 7 folders (My Documents, My Music, My Videos, and My Pictures). This is because the real names are simply Documents, Music, Videos, and Pictures, like you see now in Windows 8. So simply use this command as a reference:

robocopy E:\Users\Home\Documents C:\Users\Home\Documents /MIR /R:0 /W:0
Quick Tip: If you’re dealing with a bad hard drive, try copying one folder at a time instead of copying everything at once as it help you narrow down other potential problems.

Robocopy’s best feature is that preserves all NTFS attributes found in files and folders, and it also has the ability to mirror the data structure across different locations. For example, from a dying hard drive to a new one. The Robust File Copy can also resume from interruptions like network outages to complete the task.

About the author

Mauro Huculak is a Windows How-To Expert who started Pureinfotech in 2010 as an independent online publication. He has also been a Windows Central contributor for nearly a decade. Mauro has over 15 years of experience writing comprehensive guides and creating professional videos about Windows and software, including Android and Linux. Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 21 years of combined experience in technology. Throughout his career, he achieved different professional certifications from Microsoft (MSCA), Cisco (CCNP), VMware (VCP), and CompTIA (A+ and Network+), and he has been recognized as a Microsoft MVP for many years. You can follow him on X (Twitter), YouTube, LinkedIn and Email him at [email protected].