A given device/inode tuple should be unique for a given configuration, but keep in mind that if you're dealing with transient filesystems (e.g. sshfs) that the tuples may not stay consistent across remounts (both device and inode could change for the same path).

## Stat something on an sshfs-mounted volume $ stat -s /Volumes/foo/Makefile.am st_dev=754974730 st_ino=4 st_mode=0100664 st_nlink=1 st_uid=501 st_gid +=501 st_rdev=0 st_size=41056 st_atime=1206379971 st_mtime=1206379971 +st_ctime=0 st_birthtime=0 st_blksize=65536 st_blocks=88 st_flags=0 $ umount /Volumes/foo ## convenience wrapper to call sshfs with some extra options $ sshfsmount somehost:foo foo ICON: foo => /Users/fletch/lib/icons/icns/gir.icns $ stat -s /Volumes/foo/Makefile.am st_dev=754974731 st_ino=3 st_mode=0100664 st_nlink=1 st_uid=501 st_gid +=501 st_rdev=0 st_size=41056 st_atime=1206379971 st_mtime=1206379971 +st_ctime=0 st_birthtime=0 st_blksize=65536 st_blocks=88 st_flags=0

So long as you're only comparing them inside a run and your filesystem's not dropping out from underneath you should be OK, but don't depend on it across remounts / reboots. In that case I'd move to something more intrinsic to the file (say Digest::SHA1) that could be recalculated (but that's going to entail more work and IO than just using the paths and stat metainfo).

The cake is a lie.
The cake is a lie.
The cake is a lie.


In reply to Re: stat to identify files? by Fletch
in thread stat to identify files? by Skeeve

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.