http://www.perlmonks.org?node_id=859615


in reply to Detecting whether two pathes refer to the same file

A quick look on CPAN turns up File::Same and File::is, both of which do file comparisons (Including checking if it is the 'same' file in different locations), so specific mention of symlinks, but they use the INODE approach for comparisons so it should be workable.

File::is is much newer though. I haven't tested/used either, and there may well be others, but this seems to be a problem a lot of other people have thought about, so I am sure a good solution exists out there! Hope this helps!

Just a something something...
  • Comment on Re: Detecting whether two pathes refer to the same file

Replies are listed 'Best First'.
Re^2: Detecting whether two pathes refer to the same file
by rovf (Priest) on Sep 10, 2010 at 10:42 UTC
    A quick look on CPAN turns up File::Same and File::is
    File::Same doesn't check, whether two pathes name the same file, but whether two pathes point to (possibly different) files, having the same content.

    File::is tries to verify the identity of the files, but only by inode number, which is (as we have learned from ambrus is not even correct on Unix, and does not work at all on Windows :-(

    -- 
    Ronald Fischer <ynnor@mm.st>
Re^2: Detecting whether two pathes refer to the same file
by rovf (Priest) on Sep 10, 2010 at 09:53 UTC
    Thanks a lot, I will have a look at them!

    -- 
    Ronald Fischer <ynnor@mm.st>