Stuck with permissions in using FileUtils

Even if I am using PaperClip & Delayed_job, I guess the issue maybe
solved by FileUtisl gurus …

here is the case :

I am testing a delayed video format transcoding , transcoding works
perfectly but I get an issue -trying to write back the transcoded
video from a tmp directory into the PaperClip path

the original uploaded video file is stored into the :url => “/system/
clips/:data/65/original/swing.avi”,

in the delayed_job, I get the clip :
clip = Clip.find(65)
@clip_file = clip.data.path # => ( “… rails/myapp/public/
system/clips/data/65/original/NickFaldo.avi” )
@clip_dir = File.dirname(@clip_file) # => ("… /ls/myapp/
public/system/clips/data/65/original" )
basename = File.basename(@clip_file, File.extname(@clip_file))

=> NickFaldo

the ffmpeg transcoding process, is writing an output file into the tmp
dir , without any problem
@tmp_dir = FileUtils.mkdir_p(Rails.root.join(“tmp”, “converted”,
“#{clip[:id]}”)) # => ( “…/clips/tmp/65i” )
@tmp_file = File.join(@tmp_dir, “#{basename}.mp4”) # =>
( “…/clips/tmp/65/NickFaldo.mp4” )

until then everything works as expected …

then I want to bring back the transcoded clip in place of the original
one … with the same base name but with an .mp4 extension
@converted_file = File.join(File.dirname(@clip_file),
“#{basename}.mp4” ) # => ( “… rails/myapp/public/system/clips/
data/65/original/NickFaldo.mp4” )

so I wrote :
FileUtils.rm @clip_file # remove clip_file # to remove
the previous original
FileUtils.chmod(0777, @clip_dir )
FileUtils.cp @tmp_file, @converted_file # copy
transcoded file as new original
FileUtils.rm_r @tmp_dir #
remove tmp directory

but I get an Errno::EACCES:0x00000007820b98 exception raised
( not being root I believe I can’t change the permissions and write
into the PaperClip path for this clip …

any suggestion will be welcome … thanks