I have a set of files named like:
Friends - 6x03 - Tow Ross\' Denial.srt
Friends - 6x20 - Tow Mac and C.H.E.E.S.E..s
Edit: found a better way to list the files without using IFS
and ls
while still being sh
compliant.
I would do a shell script for that:
#!/bin/sh
for file in *.srt; do
if [ -e "$file" ]; then
newname=`echo "$file" | sed 's/^.*\([0-9]\+\)x\([0-9]\+\).*$/S0\1E\2.srt/'`
mv "$file" "$newname"
fi
done
Previous script:
#!/bin/sh
IFS='
'
for file in `ls -1 *.srt`; do
newname=`echo "$file" | sed 's/^.*\([0-9]\+\)x\([0-9]\+\).*$/S0\1E\2.srt/'`
mv "$file" "$newname"
done