Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Finding Hard links

by Ultra (Hermit)
on Nov 08, 2005 at 06:40 UTC ( [id://506623]=note: print w/replies, xml ) Need Help??


in reply to Finding Hard links

Basically "hard link files" are not different files, there is just one file, and the other file names point to the same file. So, your problem is not finding "the files" but finding the names.

This may be a little tricky, and here's why:

  • First you need to find out if there are hard links to the file (use Perl's builtin stat to find out).
  • If there are any hard links, then you need to test all files and see if they point to the same inode (remember there is only one file and multiple names); for this, again you may use stat.
  • The tricky part is that there may be hard links that your user can't access (directory/file permissions etc.)

    I don't know if there is a CPAN module for this, but using File::Find and stat you could create one yourself ;-)

    Dodge This!

    Log In?
    Username:
    Password:

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

    How do I use this?Last hourOther CB clients
    Other Users?
    Others admiring the Monastery: (3)
    As of 2024-04-25 22:00 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found