I have several thousand image files that have been corrupted by some rogue process on my machine. I have some .NET code to discover broken files. I would like to enumerate and access previous versions of those files (Windows 8 File History is enabled) and restore working versions.
I have found this page with information about how to configure file history in code, but nothing on how to access the previous versions in code. Is there a straightforward API for this?
In the end, I'd overlooked the obvious. With file history, backups are written to a configurable location. I checked my file history drive, and found a directory structure mirroring my source drive. Multiple versions of each backed up file are present, each with a date and time suffix. e.g. mytextfile.txt
has multiple versions with names like mytextfile (2013_05_15 10_22_00 UTC).txt
.
It was straightforward to match source files with backups using a simple regular expression. No fancy Win API calls needed.
I'd still be interested to know, for future reference, if there's a more 'scientific' way to do this.
Found a sample here: FileHistory Sample
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With