0

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?

1

You can use a COW (Copy On Write) file-system, but you wont use symlinks. You would just copy the file. (but it would not copy it, until you edit/write to it).

or use some over-lay file-system, that has this property: look at what fuse file-systems exist.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.