I have a model with a avatar
paperclip attach. It has now a plain standard path
has_attached_file :avatar,
:path => \"/:id-:style-:filename\"
<
I would write a rake task (or just a plain script if you prefer, to be run in the rails context). If you're using the aws-s3 gem, iterate over the instances of the model which you know they have the old path format or try writing some condition on the filename to match them, and the move one by one.
Model.find_in_batches(:batch_size => 500,
:conditions => "avatar_filename like 'SOMETHING_MATCHING'") do |o|
AWS::S3::S3Object.rename(old_path(o.avatar), o.avatar.url, 'BUCKET_NAME')
end
If you have already configured avatar with the new path definition, write a method that can build the old path based on the avatar properties.
You can read the aws-s3 gem docs here to see how to establish a connection to your S3 account.