Last active
September 13, 2015 04:42
-
-
Save franciscomxs/8df6543136cd7cb6810b to your computer and use it in GitHub Desktop.
Rename my animes and series to use Episode.Extension format
This file contains hidden or 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
REGEX = /([0-9]{2,3}).*([\.mp4|\.mkv|.rmvb|.avi]{4,5})/ | |
Dir['*'].each do |file_name| | |
if (match = REGEX.match(file_name)) && File.exist?(file_name) | |
new_name = "#{match[1]}#{match[2]}" | |
File.rename(file_name, new_name) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment