Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change symlink target while preserving inode

Normally to change a symlink target one will first unlink the file and then re-creating the symlink with the new target path. However it will be assigned a new inode number.

Maybe there is a private Mac api with an update_target_for_symlink() function, so the inode can stay the same?

In case you wonder what I need it for.. a file manager. I doubt that this is possible at all. Anyways thats what makes it interesting.

like image 293
neoneye Avatar asked Jul 28 '10 00:07

neoneye


People also ask

What happens to a symlink if its target is deleted?

If a symbolic link is deleted, its target remains unaffected. If a symbolic link points to a target, and sometime later that target is moved, renamed or deleted, the symbolic link is not automatically updated or deleted, but continues to exist and still points to the old target, now a non-existing location or file.

How do you follow a symbolic link?

In order to follow symbolic links, you must specify ls -L or provide a trailing slash. For example, ls -L /etc and ls /etc/ both display the files in the directory that the /etc symbolic link points to. Other shell commands that have differences due to symbolic links are du, find, pax, rm and tar.


1 Answers

It looks a lot like this isn't possible at all.

like image 115
bukzor Avatar answered Nov 14 '22 21:11

bukzor