如何找到当前文件的符号链接?

Eri*_*ric 4 php perl

有没有办法在PHP或Perl中找到当前文件的所有符号链接?

Eth*_*her 7

如果没有遍历文件系统寻找所有符号链接,然后检查他们的目的地,没有.但如果你仍然想要这样做,那就非常简单:

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;
    },
    '/'
);
Run Code Online (Sandbox Code Playgroud)