Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- require 'rubygems'
- require 'cloudfiles'
- unless ARGV.length == 2
- puts "usage: #{$0} username api_key"
- exit(1)
- end
- cf = CloudFiles::Connection.new(:username => ARGV[0], :api_key => ARGV[1])
- #Random Vars I need
- val2 = 0
- iterate=1
- mb = 1024 * 1024
- gb = mb * 1024
- marker = ""
- contcount = cf.containers.count
- if contcount > 10000
- until iterate == contcount
- cf.containers(:marker => marker).each do |iter|
- val1 = cf.container(iter.bytes)
- val2 += val1
- if (iterate % 10000) == 0
- marker = cf.containers(:marker=> marker)[9999]
- end
- iterate += 1
- end
- end
- else
- cf.containers.each do |iter|
- val1 = cf.container(iter).bytes
- val2 += val1
- end
- end
- puts "Cloud Files currently uses " + (val2 / gb).to_s + "GB(" + (val2 / mb).to_s + "MB)"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement