List all symbolic links on a directory

a short question: is it possible to list all symbolic links onto a directory other than running a find over the whole filesystem?

Background: I have a directory containing a lot of different versions of a library and I'd like to do some cleanup work and delete the versions which weren't used in any projects.

Thanks, Mathias


Solution 1:

Unfortunately no. All information about a symlink is stored within the symlink itself, therefore it's impossible to find without scanning the entire filesystem.

Solution 2:

You could something like this:

find /suspected/symlink/locations -type l -exec ls -l {} \; | grep ' SimlinkTargetDirectory'

Solution 3:

ls -F will list everything but will give you a visual indication of what type the files are. Is that useful?