c# - Unique file identifier in windows -


File, file names and content modifications for the lifetime of the file? (Windows 2000 and later) Copying a file should copy that it is its unique identifier

My application adds different meta-data with different files. If the files are modified, renamed or moved, then the file associations will automatically be able to identify and update it.

FileSystemWatcher can provide events that notify these types of changes, though it uses a memory buffer if many file system events are faster, then easily loaded (and Events can be lost).

There is no use of a hash because the contents of the file can change, and therefore the hash will change.

I thought about using the file creation date, though there are some situations where it will not be unique (i.e. when many files are copied).

I have also heard of a file SID (Security ID in the NTFS?), But I'm not sure that it will do the things I see.

Any thoughts?

If you call, you will get a file id in BY_HANDLE_FILE_INFORMATION.nFileIndexHigh / Low. This index is unique within the volume, and if you take the file (within the volume) or change its name, it still remains on it.

If you can assume that NTFS is used, you may want to consider using the alternative data stream to store the metadata.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -