I am attempting to right a small utility that checks one file against an automated snapshot of itself in a different location to make sure that they are the same. I have not had any luck doing this and thought I would present this to you to see if you can help me out.
So far when I execute my code everything that is not an actual file shows as equal but, anything else that is not shown as a file shows as not equal. Now I have tried this using several different utilities.
1. y.size == z.size
and also what you see in the code listed below. Neither seem to give me a result showing that these files are equal.
Can anyone advise me on how I can better implement this? Also how I can get rid of the "." files in the directory
~
Code:
require 'fileutils'
require 'ftools'
y = Dir.entries("\\\\corporate\\finance\\Private\\BNADataFile\\")
z = Dir.entries("\\\\corporate\\finance\\Private\\BNADataFile\\.snapshot\\hourly.0\\")
y.each do |y|
z.each do |z|
if(FileUtils.uptodate?(y,z))
puts y + ": Same"
else
puts y + ": Not the same"
end
end
end
Code:
C:\Documents and Settings\lmcilwain\My Documents\scripts\work>ruby check.rb
.: Snapshot not the same, please address
.: Snapshot Successful
.: Snapshot Successful
.: Snapshot Successful
.: Snapshot Successful
.: Snapshot Successful
.: Snapshot Successful
.: Snapshot Successful
..: Snapshot Successful
backup: Not the same
Archived..cdb: Not the same
OPInc..cdb: Not the same
ArchivedAlt.cdb: Not the same
Alts.cdb: Not the same
event.log: Not the same
C:\Documents and Settings\lmcilwain\My Documents\scripts\work>