Ruby/File Directory/identical
Материал из Wiki.crossplatform.ru
Are two files identical
File.identical?("ruby", "ruby") # => true if the file exists File.identical?("ruby", "/usr/bin/ruby") # => true if CWD is /usr/bin File.identical?("ruby", "../bin/ruby") # => true if CWD is /usr/bin File.identical?("ruby", "ruby1.9") # => true if there is a link
Checking whether two files are identical is easy
puts "They"re identical!" if File.identical?("file1.txt", "file2.txt")