Skip to content

Instantly share code, notes, and snippets.

@djadriano
Created January 22, 2017 23:07
Show Gist options
  • Save djadriano/78aabf42d567852c1d73ec05687d59a0 to your computer and use it in GitHub Desktop.
Save djadriano/78aabf42d567852c1d73ec05687d59a0 to your computer and use it in GitHub Desktop.
Script for copy files to another directory
require 'fileutils'
dirToFind = '/Users/adrianofernandes/Desktop/singles/euphoric/**/*.mp3'
Dir[dirToFind].each do |old|
if File.basename(old).include?('(radio')
puts '-----------------------------------------'
puts 'have a radio version'
puts old
puts '-----------------------------------------'
File.delete(old) if File.exist?(old)
else
puts '-----------------------------------'
puts 'Copying Files'
puts '-----------------------------------'
puts old
dest_folder = "/Users/adrianofernandes/Music/hardstyle/organized/renamed/euphoric/"
FileUtils.cp(old, dest_folder)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment