Created
March 16, 2011 16:29
-
-
Save arikfr/872769 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Asset.find_in_batches do |group| | |
group.each do |asset| | |
if asset.is_image? | |
current_url = asset.resource.path | |
new_url = asset.resource.path(:large) | |
if AWS::S3::S3Object.exists? current_url, S3Config['bucket_name'] | |
begin | |
AWS::S3::S3Object.copy current_url, new_url, S3Config['bucket_name'], :copy_acl => :true | |
puts "File copied [#{current_url}] => [#{new_url}]." | |
rescue | |
puts "Copy failed" | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment