How can I figure out what files are corrupt or missing on my hard drive?

David Orlow 1 Reputation point

Ok, this is something I've pondered in the past. I have pictures and videos on my NAS for 20 years. Every so often, I start looking around folders and then something sparks a memory and I look for a picture or a video that I remember having and sometimes can't find them. Sometimes I'll find a picture or video that is corrupt.

I have backuips. But, backups are no good if I don't notice it's missing for a year after it's missing and my backups have cycled. I need a way to know when I have missing files or corrupt files. I was thinking for corrupt files, if it could take an inventory of my hard dirve and generate an md5 hash of each file to compare later to let me know if a file has changed.

A while back, I was trying to figure out how to script this. It would be a whole lot nicer if I found a commercial application that was designed for this. Any ideas?

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,822 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,305 questions
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,170 questions
0 comments No comments
{count} votes

7 answers

Sort by: Most helpful
  1. S.Sengupta 15,841 Reputation points MVP

    To locate the corrupted files, access the CBS.Log. you will find it at:



  2. David Orlow 1 Reputation point

    this looks promising...

    I could write a PS script using this commandlet. Maybe I'll just do my own thing again. I've gotten better at scripting since my last attempt and this is a built in tool in the OS...

    0 comments No comments

  3. David Orlow 1 Reputation point

    This seems to be working... but still would rather a commercial application. I'm going to be messing around with the logic a lot trying to get it right.

    $files = Get-ChildItem z:\ -Recurse | where { ! $_.PSIsContainer } | Select -First 50
    foreach ($file in $files) {
        Write-Host "Filename is " + $file.FullName
        Get-FileHash $file.FullName -Algorithm SHA384 | Export-Csv -NoTypeInformation C:\Users\dmorl\Documents\2023-02-24-1957-output.csv -Append
    0 comments No comments

  4. David Orlow 1 Reputation point

    Maybe the get-filehash won't work... right now, i have it running on 50 of my files and it's taking forever. I'm sure it's taking forever on video files. I have a ton of video files. I dont have enough processing power to push these through fast enough to be useful.

    0 comments No comments

  5. David Orlow 1 Reputation point

    Got to thinking 384 is excessive. Trying MD5. I know no one is replying. Helps me think though typing it out and maybe it'll help someone else out someday.

    0 comments No comments