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

On Windows NTFS there is a similar concept to an inode number, but it is a 64-bit index number split into two 32-bit numbers "Low" and "High". Like inodes, these numbers are only unique within a partition, so you also need to take into account the Volume Serial Number (VSN).

See Win32::IdentifyFile. The information returned by IdentifyFile is Volume Serial Number, File Index High, File Index Low. I am the author, so let me know if you have any issues.

On FAT I don't think you have any options like this.
  • 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 afoken (Chancellor) on Sep 10, 2010 at 11:10 UTC
    On FAT I don't think you have any options like this.

    Right. While it is possible to create a hardlink within a FAT filesystem using a disk editor, most -- if not all -- FAT filesystem checkers consider this a filesystem error. FAT is defined in a way that each file must have exactly one directory entry, and so the fully qualified file name (relative to the filesystem) uniquely identifies a file. With VFAT (i.e. FAT + long names), things become a little bit different, because each path element may have a "long" and a "short" name. Normalizing the paths of two files to use only "short" or "long" elements gives compareable, unique identifiers.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re^2: Detecting whether two pathes refer to the same file
by rovf (Priest) on Sep 10, 2010 at 11:03 UTC
    Would your module also work on files which reside on, say, Linux, but are accessed from Windows via WinNFS, Samba or CIFS? This wouldn't be NTFS either, would it?

    -- 
    Ronald Fischer <ynnor@mm.st>
      I have never tried it, and don't currently have a working Samba link to help. I doubt it, but I have been surprised before. I wouldn't like to bet one way or the other.

      Let me know if you try it!