Hi.
I have a lot of series that is named CSI.New.york.404.avi or Heroes.205.HDTV-lol.avi
Can I use Hazel to rename them to Heroes.S02E05.avi? Where S02E05 is the important part.
Moderators: Mr_Noodle, Moderators
([0-9])([0-9])([0-9])
S0\1E\2\3
\.([0-9])([0-9][0-9])\.
.S0\1E\2.
Name.of.Show.S01E01.HDTV.XviD-LOL.avi
Name of Show - 1x01 - (title of episode to be added later).avi
This will replace S01E01 with 1x01 and S10E12 with 10x12:
Replace: /(\.S0(\d)E(\d\d))?(?(1)|\.S(\d\d)E(\d\d))/
With: - \2\4x\3\5 -
This will remove all the release info:
Replace: /(\.HDTV)|(\.PDTV)|(\.WS)|(\.DSRip)|(\.XviD)|(\-LOL)|(\-2HD)|(\-aAF)|(\-0TV)|(\-DOT)|(\-FQM)|(\.\[VTV\])|/
(Leave the replacement blank)
And this will replace all . with a space (save the file extension space):
Replace: /\.(?!\w\w\w?\w?$)/
With: (a space)
#!/usr/bin/perl
$name = @ARGV[0];
$oldname = $name;
# Change episode numbers
$name =~ s/(\.S0(\d)E(\d\d))?(?(1)|\.S(\d\d)E(\d\d))/ - \2\4x\3\5 -/g;
# Remove release information
$name =~ s/(\.HDTV)|(\.PDTV)|(\.WS)|(\.DSRip)|(\.XviD)|(\-LOL)|(\-2HD)|(\-aAF)|(\-0TV)|(\-DOT)|(\-FQM)|(\.\[VTV\])|//g;
# Replace all periods with a space ignoring the filetype
$name =~ s/\.(?!\w\w\w?\w?$)/ /g;
system("mv", $oldname, $name);