Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I access Windows 8 File History programatically?

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?

like image 292
Olly Avatar asked Jun 13 '13 20:06

Olly


2 Answers

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.

like image 123
Olly Avatar answered Oct 21 '22 19:10

Olly


Found a sample here: FileHistory Sample

like image 1
bbqchickenrobot Avatar answered Oct 21 '22 18:10

bbqchickenrobot