Duplicating a Paperclip attachment without running processors?

I need to duplicate an object that has an attached Paperclip file. This file (depending on its file-type) may have two to four different styles, with separate file-processing stages required for each. Some of these involve transcoding in FFMPEG, so I would really rather not run the processors all over again, when the various re-coded versions already exist on S3.

The naive thing (which I have done, and works) is simply to create a new object, open the original file from S3 using open-uri, and run the process over again. This works, but takes a long time, since some of these movie files are large and the processing steps to make thumbnails and poster frames are weighty.

Searching for solutions on this, I came across the dup method, and I also saw a dup method on the Paperclip attachment when I inspected its methods. Before I go into a lengthy yak-shaving exercise here, can anyone point me to a simpler way to manage what I am trying to accomplish here? Essentially I want to duplicate a group of files in place on S3 (yes, I realize you can't do that without copying them) but I want to skip all the processing steps and just duplicate the styles "manually".

Thanks in advance,

Walter

Replying to my own, since I posted after beer-thirty on Friday.

I need to duplicate an object that has an attached Paperclip file. This file (depending on its file-type) may have two to four different styles, with separate file-processing stages required for each. Some of these involve transcoding in FFMPEG, so I would really rather not run the processors all over again, when the various re-coded versions already exist on S3.

The naive thing (which I have done, and works) is simply to create a new object, open the original file from S3 using open-uri, and run the process over again. This works, but takes a long time, since some of these movie files are large and the processing steps to make thumbnails and poster frames are weighty.

Searching for solutions on this, I came across the dup method, and I also saw a dup method on the Paperclip attachment when I inspected its methods. Before I go into a lengthy yak-shaving exercise here, can anyone point me to a simpler way to manage what I am trying to accomplish here? Essentially I want to duplicate a group of files in place on S3 (yes, I realize you can't do that without copying them) but I want to skip all the processing steps and just duplicate the styles "manually".

Here's another thing I have found: http://blog.firsthand.ca/2011/07/ruby-script-to-duplicate-s3-bucket.html which is to duplicate an entire bucket. I'm not sure of my terminology here, is a bucket always the outermost container, or is it any level of "directory" in a named bucket? I've been reading the source of right_aws here: https://github.com/rightscale/right_aws/blob/master/lib/s3/right_s3.rb and there is a copy_key method that looks useful, but I am leery of creating a duplicate Paperclip object without involving Paperclip. Is the relationship between an attachment and all of its versions merely predicated on the file paths? Is there any metadata stored elsewhere that I would also need to duplicate?

Thanks,

Walter