diff --git a/lib/collect_user_photos.rb b/lib/collect_user_photos.rb index 50799f376..f59c73748 100644 --- a/lib/collect_user_photos.rb +++ b/lib/collect_user_photos.rb @@ -1,7 +1,5 @@ module PhotoMover - def self.move_photos(user) - Dir.chdir Rails.root temp_dir = "tmp/exports/#{user.id}" FileUtils::mkdir_p temp_dir @@ -15,14 +13,13 @@ module PhotoMover photos.each do |photo| current_photo_location = "#{Rails.root}/public/uploads/images/#{photo.image_filename}" new_photo_location = "#{photos_dir}/#{photo.image_filename}" - - FileUtils::cp current_photo_location new_photo_location + FileUtils::cp current_photo_location, new_photo_location end - system("tar", "cf #{user.id}.tar #{user.id}") - FileUtils::rm_r user.id, :secure => true, :force => true + `tar c #{user.id} > #{user.id}.tar` + #system("tar", "c", "#{user.id}",">", "#{user.id}.tar") + FileUtils::rm_r "#{user.id.to_s}/", :secure => true, :force => true "#{Rails.root}/#{temp_dir}.tar" end - end