Question: I am working on an application that keeps track and uses files stored on the file system. Users are allowed to open, create, delete and move files in the file system. Meanwhile my application is not constantly running so I can't keep track of all changes real-time. Afterwards my application has to find out what file is whom (i.c. as identified in my application).

The most preferred solution for the users is that the application solves every change itself. Each user-interaction is less preferred. 

One of my ideas was to use an attribute of a file and assign a key-value to it so when it has been identified once, it can always been recognized afterwards. But I don't know if there is such an attribute. This article didn't give much hope: [There is in Windows file systems a pre computed hash for each file?](https://stackoverflow.com/questions/1490384/there-is-in-windows-file-systems-a-pre-computed-hash-for-each-file).

Does somebody know if there is such an attribute I can use? And how can I used it in C#?

Is there anyone who is running up against this problem? And how did you solve it?

I'd like to hear good suggestions.

regards, Jaap

Answer: 
If your files don't leave NTFS, this is easily achievable by alternative data streams, where you can store your data along with files. This is more-or-less good article about ADS: <http://www.flexhex.com/docs/articles/alternate-streams.phtml>

There is another suitable method - it's very efficient, but also very complicated to use, it requires quite good knowledge about NTFS internals - USN Change Journal; see <http://msdn.microsoft.com/en-us/library/windows/desktop/aa363798.aspx>. With USN Change Journal, you can "get" very efficiently all files that were changed (even all change events) within specified time period.

Nevertheless, if your files leave NTFS realm, e.g. if it's copied to FAT32, contents of ADS is lost.
Relying on a File attribute is "dangerous" in that some user could alter the attribute while your program isn't running. This could lead you to believe that a certain file is (or isn't) tracked by the program while it really isn't.

I would suggest to keep track of the files in a database, XML, or some other file. When your application starts you read the file/db and check for new/deleted/editted files.

You could store a Hash of the files to find out if a file has been moved/editted. Keeping track of files that are moved AND editted is going to be pretty difficult. (I have no clue how you could achieve it)

PS: Have you considered making your application a Windows service? Having the file-management running in the background no matter if the GUI part of your application is running or not?