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!