views:

97

answers:

1

Hello,

Using PHP on Linux, I can just use the is_link() function to detect whether a given file is a symbolic link. However, is there a way to detect if a given file is the target of any other symbolic links?

Thanks, Brian

+3  A: 

No.

And this is not even possible with ordinary links.

Periodically, a Unix-like-OS (and for that matter, a Windows version) ships with cron setup to keep a database of files in order to speed up searching. Such a database certainly could map files and links in both directions but it would not necessarily give currently accurate results.

DigitalRoss
Thanks very much
Brian
I should add that with ordinary non-symbolic links it is easily possible to know how many links the file has, but not where those links are. With symbolic links, it is not even known how many there are.
DigitalRoss
After all, there may be symlinks in paths that you don't have permission to see - or even on volumes that aren't currently mounted.
caf