Reputation: 1625
I am trying to build an app that synchronizes files on my computer with files on my webserver. In my current situation my app watches a series of paths that contain files to sync. The problem with this solution is that when I locally rename a file, it no longer matches any of the paths and gets uploaded as a new file, instead of overwriting the old file. What I want to do is add an attribute like documentID to the file, so I can check it no matter what the filename is.
Can anyone point me in the right direction?
Upvotes: 3
Views: 287
Reputation: 21004
You cannot. What you're seeking is to add metadata to a file. This is why revision software like Perforce exist in the first place. This kind of software track all the files inside a depot and keep records of all the changes, renames, deletion and creation of files. But even Perforce has its limits as it cannot change links between files.
In the case you want a full-proof solution, a BigFile is the answer for a perfect file tracking. But at this point, you are outside of Windows support. Most video game company use the concept of BigFile as it allows every file present inside to be track by ID instead of names. All the files are then known as ID and path is only a user convenience. A file refer to another one by its ID, and nothing else.
In a huge project I took part in, we had a BigFile integration with Perforce on top to serve as revision history. The BigFile would serialize a "outside" file and give it to Perforce for history. When we would get the lastest version, the BigFile would ask Perforce for all the last version and re-integrate them inside.
But if you only do Office files, Perforce, Alienbrain, CVS or Subversion are all software that would solve your problems.
Upvotes: 1