Method: FileUtils#copy

Defined in:
lib/batch_audio_convert/file_utils.rb

#copy(origin, destination) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/batch_audio_convert/file_utils.rb', line 58

def copy(origin, destination)
  puts_and_logs "Copying \"#{origin}\" to \"#{destination}\"."
  return if config[:simulate]
  unless should_process_file? destination
     puts_and_logs ' - File exists. Skipping copy...'
    return
  end
  verify_destination_folder(destination)
  begin
    FileUtils.copy_file origin, destination
  rescue Exception => e
    logger.error "An error occurred during the copy - #{e.message}"
  end
end