Skip to content

Instantly share code, notes, and snippets.

@drunkhacker
Created March 2, 2013 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drunkhacker/5069147 to your computer and use it in GitHub Desktop.
Save drunkhacker/5069147 to your computer and use it in GitHub Desktop.
require 'fog'
conn = Fog::Storage.new(:provider => 'AWS')
conn.get_bucket("doors-and-dots").body["Contents"].each do |h|
key = h["Key"]
if key.match /square100\.[a-z]+$/
puts "processing #{key}"
obj = conn.get_object("doors-and-dots", key)
newkey = key.gsub /square100/, 'square200'
conn.put_object("doors-and-dots", newkey, obj.body, {"x-amz-acl"=>"public-read", "Content-Type"=>"image/jpeg"})
end
end
@drunkhacker
Copy link
Author

doors-and-dots bucket에 있는 square100을 square200 이름으로 복사.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment