Skip to content

Instantly share code, notes, and snippets.

@wezm
Created April 16, 2009 02:38
Show Gist options
  • Save wezm/96177 to your computer and use it in GitHub Desktop.
Save wezm/96177 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'aws/s3'
proxy = {
:host =>'host',
:port => 3128,
:user =>'user',
:password =>'pass',
}
AWS::S3::Base.establish_connection!(
:access_key_id =>'key',
:secret_access_key =>'',
:use_ssl => true,
:proxy => proxy
)
o = AWS::S3::Bucket.objects(
'wezm-macpro-backup',
:marker => %q|wmoore/Pictures/Aperture Library.aplibrary/Crystal & Lisa's Birthday.approject/2007-10-08 @ 05:29:54 PM - 1.apimportgroup/IMG_1543/Info.apmaster|,
:max_keys => 2
)
o.each do |oo|
puts oo.key
end
exit
b = AWS::S3::Bucket.find('wezm-macpro-backup')
o = b.objects
c = 0
File.open('s3_listing.txt', "w") do |f|
while(o.size > 0)
o.each do |obj|
f.puts obj.key
end
c += o.size
o = b.objects(:marker => o.last.key)
puts c
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment