Uniquely identify files/folders in NTFS, even after move/rename

Posted by Felix Dombek on Stack Overflow See other posts from Stack Overflow or by Felix Dombek
Published on 2011-02-19T17:52:09Z Indexed on 2011/02/20 23:25 UTC
Read the original article Hit count: 179

Filed under:
|
|
|
|

I haven't found a backup (synchronization) program which does what I want so I'm thinking about writing my own.

What I have now does the following: It goes through the data in the source and for every file which has its archive bit set OR does not exist in the destination, copies it to the destination, overwriting a possibly existing file. When done, it checks for all files in the destination if it exists in the source, and if it doesn't, deletes it.

The problem is that if I move or rename a large folder, it first gets copied to the destination even though it is in principle already there, just has a different path. Then the folder which was already there is deleted afterwards.

Apart from the unnecessary copying, I frequently run into space problems because my backup drive isn't large enough to hold the original data twice.

Is there a way to programmatically identify such moved/renamed files or folders, i.e. by NTFS ID or physical location on media or something else? Are there solutions to this problem?

I do not care about the programming language, but hints for doing this with Python, C++, C#, Java or Prolog are appreciated.

© Stack Overflow or respective owner

Related posts about file

Related posts about synchronization