In Ruby 1.8, I would call File.compare() from the "ftools" library to easily compare the contents of two files.
However, in Ruby 1.9, "ftools" is replaced by "fileutils", which doesn't have a "compare" method. What's the equivalent call?
In Ruby 1.8, I would call File.compare() from the "ftools" library to easily compare the contents of two files.
However, in Ruby 1.9, "ftools" is replaced by "fileutils", which doesn't have a "compare" method. What's the equivalent call?
Ahh, the method has been renamed to compare_file in FileUtils.
There's also an alias of "cmp" in both versions.
Old question, but I just got here from google. identical?
is available for those who like me prefer that coding style.
FileUtils.identical?(exp, act)
File#identical?
, which only checks, if the files are actually the same physical files on the drive. –
Skewback © 2022 - 2024 — McMap. All rights reserved.