Program, or workflow to update a single file and update all instances of it everywhere else

filefilesystem

Is there a program, or a workflow that is best for working with a single file, and when saving to update all instances of the file on the computer, whether it be in different projects folders?

Edit (Response to Comments):
Well, I have javascript and css files that are shared between multiple projects. When I update or amend a file, I find myself having to manually copy and paste to replace the same files in all the other projects that rely on the same file(s).

Best Answer

What you are describing might be accomplished with a hard link.

Hard links mean that one file on the drive is seen as a file in multiple folders.

So, if you had a file recipe.doc and stored in your ~/Documents folder, you could hard link it elsewhere - perhaps /Users/Shared and ~/Projects/Cooking/Pasta/recipe.doc

So, the link count would be 3 for that file and only one recipe would take space on the disk. If you deleted the file in /Users/Shared - rather than deleting the file, it just removes that one link and decrements the file counter to 2. When the last link goes away, you have a link count of 1 and the file remains, but no copies in other folders.

If you want to learn more, the link command is a terminal command written as ln.

Also, you could check that file into some sort of code control system like git and script the checkout in the folders of your liking. It really depends on how much time you'll save or if you just want to write a quick and dirty shell script to push the changed file elsewhere (or use rsync to copy just the changed bits and be über efficient).