From: Michael Guterl Date: 2008-10-25T04:30:56+09:00 Subject: Re: How to tell if two paths point to the same file? On Fri, Oct 24, 2008 at 3:15 PM, Nobuyoshi Nakada wrote: > Hi, > > At Sat, 25 Oct 2008 03:21:21 +0900, > Kenneth McDonald wrote in [ruby-talk:318516]: >> From the documentation, that seems to compare to different files to >> see if they have the same content. Thanks for the suggestion, though. > > It tells whether two files are an identical file, in other > words, same hardlinks. The doc is too terse? > macbook:~ michaelguterl$ ri File::identical ------------------------------------------------------- File::identical? File.identical?(file_1, file_2) => true or false ------------------------------------------------------------------------ Returns +true+ if the named files are identical. open("a", "w") {} p File.identical?("a", "a") #=> true p File.identical?("a", "./a") #=> true File.link("a", "b") p File.identical?("a", "b") #=> true File.symlink("a", "c") p File.identical?("a", "c") #=> true open("d", "w") {} p File.identical?("a", "d") #=> false Seems pretty concise to me...