Last active
June 6, 2016 03:48
-
-
Save cristianoliveira/45e7a8c78d2662f9e828083adb2bab38 to your computer and use it in GitHub Desktop.
Music folder sorter
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' | |
musics = Dir["*.mp3"] | |
musics.each do |music| | |
band_name = music.split("-").first | |
dir_destiny = "#{band_name}/" | |
Dir.mkdir(band_name) unless File.exists? band_name | |
FileUtils.mv music, dir_destiny | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment