Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Detecting if a folder is a symbolic link

by merlyn (Sage)
on Mar 17, 2006 at 23:16 UTC ( [id://537610]=note: print w/replies, xml ) Need Help??


in reply to Detecting if a folder is a symbolic link

To avoid duplicates, you can sidestep the symlink issue (because any given file might also be a symlink) by stat'ing everything you process and rejecting anything where the dev/inode pair is the same. In other words:
BEGIN { my %seen; sub process { my $entry = shift; my ($dev, $ino) = stat $entry or return; $seen{"$dev $ino"}++ or return; ... rest of processing ... } }

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-25 07:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found