Created
January 22, 2017 23:07
-
-
Save djadriano/78aabf42d567852c1d73ec05687d59a0 to your computer and use it in GitHub Desktop.
Script for copy files to another directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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