2

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

maff
  • 311
  • 1
  • 4
  • 14

3 Answers3

4

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

Ignacio Vazquez-Abrams
  • 45,019
  • 5
  • 78
  • 84
1

You could something like this:

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

gravyface
  • 13,947
  • 16
  • 65
  • 100
  • Thanks, that was the method i knew, I just wanted to know if there's a simpler solution. – maff Apr 14 '10 at 21:42
1

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

sinping
  • 2,055
  • 14
  • 12