Is there a way in PHP or Perl to find all symbolic links to the current file?
Without traversing the filesystem looking for all symbolic links and then checking their destination, no. But if you still want to do this, it's pretty straight-forward:
use strict;
use warnings;
use File::Find;
my $target = 'the filename you want to find links to';
finddepth(
sub {
return if not -l $File::Find::name;
print "found $File::Find::name!\n" if readlink($File::Find::name) eq $target;
},
'/'
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With