Find all corrupted files and folders on the hard drive

( 5 Votes ) 

If your hard drive is on it's last legs developing more and more bad sectors you will start seeing corrupt files and folders. Obviously you should replace such hard drive as soon as possible.

If you have an up to date backup you can simply restore everything to your new hard drive. However if backup is not there, you may want to copy all good files, skipping the corrupted ones. It would also be useful to have list of all corrupted files so you know what exactly you lost.
If you are using online backup service and have large amount of data you can use this method to copy all remaining data to the new hard drive and then restore only corrupted files from the backup.

Windows explorer is simply not good enough for this task, use robocopy instead. Robocopy can easily skip inaccessible/corrupted files and have a text log with all such files.

If you have Windows Vista or Windows 7, robocopy is already on your system. Just open command prompt and type robocopy
If you have Windows XP or older you can download robocopy from here

robocopy.exe
robocopy "D:" "E:" /E / COPYALL /R:0 /TEE /LOG:"C:\robo-log.txt"
This will copy all data from D: drive to E: drive and save a log file to C:\robo-log.txt

Used options:

"D:" - Source
"E:" - Destination
/E
- copy subdirectories, including Empty ones.
/COPYALL - copy all file info
/R:0 - number of retries - 0. (Skips corrupted files instead of constantly retrying).
/TEE - output to console window, as well as the log file.
/LOG:"C:\robo-log.txt" - path to the log file.

After copying is completed, open the log file, scroll down to the bottom and check the summary for failed files and folders. To find which particular files were corrupted search for "The file or directory is corrupted and unreadable" in the log file. You may also want to search for "Access is denied".

Comments   

STef
0 # STef 2011-12-31 10:35
If you want just to find out which files and folders are corrupted, without actually copying them, run:
robocopy "D:" "C:\TMP" /E /CREATE /R:0 /TEE /LOG:"C:\log.txt"
This will imitate copying all data from D: drive to C:\TMP folder, but will only create folder structure and 0 bytes files.


Hi there, just using yout tip, simple & good!

But attention: The second way doesn't work for me (Win7 and NTFS) as it doesn't touch the data of the files, just the file indexes. So don't use the second option if you need to know if a file is corrupt!

And by the way: There is no way to copy into a "/dev/null" style drive, as robocopy needs to find the folder structure...
Reply | Reply with quote | Quote
admin
0 # admin 2012-01-04 16:30
Good point! I don't remember if I tested the second method with corrupted data (this was a while ago), but I'll take your word for it.
Second method removed.
Reply | Reply with quote | Quote
Chefboyct
0 # Chefboyct 2014-01-25 16:34
Quoting STef:
If you want just to find out which files and folders are corrupted, without actually copying them, run:
robocopy "D:" "C:\TMP" /E /CREATE /R:0 /TEE /LOG:"C:\log.txt"
This will imitate copying all data from D: drive to C:\TMP folder, but will only create folder structure and 0 bytes files.


Hi there, just using yout tip, simple & good!

But attention: The second way doesn't work for me (Win7 and NTFS) as it doesn't touch the data of the files, just the file indexes. So don't use the second option if you need to know if a file is corrupt!

And by the way: There is no way to copy into a "/dev/null" style drive, as robocopy needs to find the folder structure...


This command line doesn't work. It does not pick up any corrupted file nor does it stop copying without retrying. I even include /w:0 and it still doesnt work!
Reply | Reply with quote | Quote
Wayne
0 # Wayne 2012-10-03 17:03
This does not work once chkdsk has run and has fixed/repaired files. The file will copy fine, but it may be missing some data. In this case files are no longer considered corrupt and copy fine.
Reply | Reply with quote | Quote
admin
0 # admin 2012-11-18 18:20
Yes that what I would expect to happen. Once files are "repaired" with chkdsk, robocopy will not report any errors as it has no way of telling if there are any issues with data inside a file.
Reply | Reply with quote | Quote
james pierson
0 # james pierson 2013-12-12 02:42
I tried the complete command you give as an example and it comes back with error in parameter #4. All I want to do is get a listing of the corrupted files as you say can be done. Can you please provide me simple instructions with the exact command required to do this.
Reply | Reply with quote | Quote
MadMax
0 # MadMax 2014-02-04 08:14
Simply remove the single space which is inbetween the / and copyall.
robocopy "D:" "E:" /E /COPYALL /R:0 /TEE /LOG:"C:\robo-log.txt"
You might need to start cmd as an admin (create a new shortcut to cmd and run as admin)
Reply | Reply with quote | Quote

Add comment


Newsletter

Subscribe to receive occasional updates on new posts.

Your email will not be used for any other purpose and you can unsubscribe at any time.

Privacy Policy                     Login