gary on 7 Aug 2012 08:32:55 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] UNIX File Equivalence


=> Here is a good general UNIX question that somebody might know the answer
=> to.
=>
=> On UNIX, or at least on Linux, how can I determine if two files are
=> the same, preferably very quickly (ie via a system/library call and
=> not a page of PERL - though I'd still be interested in scripting/bash
=> solutions as well).

   In C, check out the stat() family of system calls. It returns a "struct
stat", and if the st_dev and st_ino values are the same, the file is
the same.

                                 Gary Duzan



___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug