Last active
August 29, 2015 14:06
-
-
Save mmstick/040aeacea375fb070fc4 to your computer and use it in GitHub Desktop.
This is a fish function -- store it inside ~/.config/fish/functions to use with fish. Renames all episodes in a directory to the TVDB naming-scheme and verbosely prints the changes. Ex: Series 1x01.mkv
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
#!/bin/fish | |
function rename-series --description 'rename-series <series_name> <season_number> <file_extension>' | |
set count 0 | |
for file in * | |
set count (math $count + 1) | |
if test (math $count \< 10) = '1' | |
mv -i -v "$file" "$argv[1] $argv[2]x0$count.$argv[3]" | |
else | |
mv -i -v "$file" "$argv[1] $argv[2]x$count.$argv[3]" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment