Skip to content

Instantly share code, notes, and snippets.

@ebot
Created June 2, 2009 19:37
Show Gist options
  • Save ebot/122521 to your computer and use it in GitHub Desktop.
Save ebot/122521 to your computer and use it in GitHub Desktop.
batch acquire log file stat maker
#!/usr/bin/env ruby -wKU
total_files = 0
# Looop through each yml file
d = Dir.new(".")
Dir.glob( '*.yml' ) do |file|
file_count = 0
log_file = File.new file, 'r'
log_text = log_file.read
log_text.scan(/.+(?=files)/).each do |count|
total_files += count.chomp.to_i
file_count += count.chomp.to_i
end
puts "#{file_count.to_s.gsub(/(\d)(?=\d{3}+(\.\d*)?$)/, '\1,')} - #{file}"
end
puts "Total Files Uploaded - #{total_files.to_s.gsub(/(\d)(?=\d{3}+(\.\d*)?$)/, '\1,')}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment