On this question or on this one (for example) you will get solutions on how to look for symlinks pointing to a given directory (let's call it /dir1
), while I am interested to symbolic links possibly pointing to any file/folder inside /dir1
.
I want to delete such directory but I am not sure that I am safe to do so, as on an other directory (let's call it /dir2
), I may have symlinks pointing to inner parts of /dir1
.
Further, I may have created these symlinks using absolute or relative paths.
My only help is that I know the symlinks I want to check are on a mounted filesystem, on /dir2
.
find -L /subtree -xtype l -exec readlink -f {} +
– ruvim Nov 30 '17 at 11:52+
do here? – Liam Jul 21 '20 at 15:24readlink
) at the position of{}
(you can also finish with;
(which needs to be escaped in many shells), to invoke the command with a single argument, which is much slower to execute. – Anthon Jul 21 '20 at 20:03