In a web project I used symlinks for shared data to save up space. The structure is one directory including the original data (e.g. css and js) and multiple directory with symlinks to the original data. The problem is when users change settings their data is going to edit, but because they are symlinks the original data gets edited. So I am searching for a way to break the link and save the data in the place of the symlink. How can I achieve this?
Something like: when writing to file if it is symlink remove it, write the data in that path.
EDIT:
I need an OS level approach, because file edit occurrences are out of my control. Also is it possible with hooks?
cp
?