Skip to content

Instantly share code, notes, and snippets.

@danhawkins
Created May 14, 2014 20:35
Show Gist options
  • Save danhawkins/eec0bbfd1d89ffea1195 to your computer and use it in GitHub Desktop.
Save danhawkins/eec0bbfd1d89ffea1195 to your computer and use it in GitHub Desktop.
Compare Script
matched_in_staging = 0
matched_in_files = 0
unmatched = []
total = 0
Dir['prod/decision/doc_file/**/*.doc'].each do |file|
total += 1
staging_check_path = file.gsub('prod/','staging/')
if File.exists?(staging_check_path)
matched_in_staging += 1
else
doc_name = file.split('/').last
doc_name = doc_name.split('_').first
doc_check_path = "2014/**/#{doc_name}*"
if !Dir.glob(doc_check_path).empty?
matched_in_files +=1
else
unmatched << file
end
end
end
puts "staging: #{matched_in_staging}, files: #{matched_in_files}, total: #{total}"
puts unmatched.join("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment