views:

96

answers:

3

I want to write a program to recover recently deleted files on windows 7..

Is there a function in windows API that recover files? If not, how can I begin in that?

EDIT:
Or an open source project for that?

EDIT:
I do not mean Recycle Bin!!

+2  A: 

Do you mean files deleted (moved to trash) or removed from the hdd (marked for replacement)? If you're looking for the second option, I'm quite sure Windows do not offer any solution to that.

Mikulas Dite
+2  A: 

You will have to analyze the data on the disk manually, i.e. by reading the raw disk content and looking for files which are marked as deleted. A good start would be reading into the internals of the filesystem(s) you want to support since you will need them. There is no API for that.

ThiefMaster
+2  A: 

Well the file recovery tools all start by scanning the disk for file headers or for old traces of the file tree.

Looking to do this from scratch you need to understand your target drive and its file system. There is no API so to say, though there are projects that deal with accessing the NTFS file system directly from linux, though it sounds like you are developing in Windows. They are listed at the end of the Wiki link in my post. I have some links that will access the drive directly. From there you can t,ry to detect old files though any means you could derive from the NTFS Journal, Log or other component of the FS.

Assuming you want to use Windows 7 and will be running your program in the OS take a look these links:

  1. Direct Drive Access
  2. Create File
  3. Wikipedia Article on NTFS (The file system Windows 7 uses) Check the external links

What your looking to write is no trivial task, though that's what makes it interesting.

JustSmith