HT compare files in Ruby?

All-

Can anyone advise:

  1. If there is a Ruby (boolean?) method that will compare the contents of
    two files and return indication as to whether or not their contents are
    identical?

  2. Beyond this, does anyone know of a Ruby script available that will prompt
    the user for two directories, then proceed to check for files (recursively
    into subdirectories) in the two directories are different, and write the
    names of non-identical pairs to the display/file. Sounds simple enough to
    write (esp using any tip provided in #1 above), but just thought if someone
    else has already done the (eg, directory prompting UI) legwork).

Many thanks.

Kurt Euler

Kurt Euler wrote:

  1. If there is a Ruby (boolean?) method that will compare the contents of
    two files and return indication as to whether or not their contents are
    identical?

require 'ftools’
File.cmp(‘f1’, ‘f2’)

require 'fileutils’
FileUtils.cmp(‘file’,‘other’)

···

il Fri, 16 Jan 2004 08:25:44 +0900, Kurt Euler keuler@portal.com ha scritto::

All-

Can anyone advise:

  1. If there is a Ruby (boolean?) method that will compare the contents of
    two files and return indication as to whether or not their contents are
    identical?

Or maybe

require 'fileutils'
FileUtils.cmp('f1', 'f2')

For some reason Ruby always seem to have at least
two ways of doing things :wink:

/Johan Holmberg

···

On Fri, 16 Jan 2004, Joel VanderWerf wrote:

Kurt Euler wrote:

  1. If there is a Ruby (boolean?) method that will compare the contents of
    two files and return indication as to whether or not their contents are
    identical?

require 'ftools’
File.cmp(‘f1’, ‘f2’)