3

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?

3
  • 1
    hm. and how should the attribute behave if the file is copied? mind that e.g. Microsoft Word deletes an old file and creates a new one when you hit "Save", so any attributes are going to be lost. Commented Oct 19, 2012 at 13:10
  • @Vlad Is that so? That's a shame and kind of a dealbreaker then, as most of the files will be office-type files. Commented Oct 19, 2012 at 13:24
  • well, the Office takes this as a security feature: if by some reason the saving fails, they don't want to lose the original file. So they save a file under some temporary name, and when the saving completed successfully, remove the original file and rename the new one. Commented Oct 19, 2012 at 14:41

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks for the answer and the alternatives. I'll look into those!
Just added a collection of software dedicated to revision control. You can also read: en.wikipedia.org/wiki/Revision_control

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.