Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Find hardlinks and symlinks in a region of the filesystem

by merlyn (Sage)
on Oct 14, 2003 at 16:13 UTC ( [id://299168]=CUFP: print w/replies, xml ) Need Help??

Curious about what links to what? Try this little snippet to find out what files are commonly referenced. The output consists of lines of things that are linked or symlinked.
use File::Find; my %results; find sub { if (-l) { # it's a symlink my ($dev, $ino) = lstat _; # reuse info from -l push @{$results{"$dev $ino"}}, $File::Find::name; if (-e) { # that points somewhere else my ($dev, $ino) = stat _; # reuse info from -e push @{$results{"$dev $ino"}}, "symlink:$File::Find::name"; } } else { my ($dev, $ino) = stat; push @{$results{"$dev $ino"}}, $File::Find::name; } }, qw(/bin /usr/bin /usr/sbin); # change this to "/" to do the whole d +isk while (my($k, $v) = each %results) { my @links = @$v; next if @links < 2; print "@links\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: CUFP [id://299168]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-16 18:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found