So, to give you an idea of my EXTREMELY ADVANCED shell scripting skills, here's what I wrote today. It works, but it's TERRIBLY unelegant.
Basically it lists the subtitle files and sends the output into a txt file, then it creates avi, mkv, mp4 lists of files according to the original filenames of the subtitles, and then it moves all the content of the final list to another folder.
Problem 1: if a subtitle exists, but not the corresponding video file, the subtitle file gets moved. It's not a big issue, since I almost never have subs in that folder without a video files to go with them, but it may happen from time to time. If problem is not solvable, I can just save my temp subs somewhere else, but as I said above, it's not an elegant solution.
Problem 2: this script creates a theoretic list of all possible filenames with all possible video extensions (in this case mp4, mkv and avi), despite the fact that these files may or may not exist, and then tries to move the files to the destination directory. Not a biggie, since files that do not exist in source dir are just ignored when the "move" command is given, but as per above problem, this solution is not elegant too.
Heaven would be something that sees the subtitle files, checks for corresponding filenames with certain other video extensions, creates a global filelist and moves files according to that list.
P.S. if you see any non-standard uses of some commands below, please don't kill me. I'm on OSX 10.8.4. For example, I could not get "ls" to list files into a single column with no other details, so I used "find".
Here it goes:
#remove tmp files from last execution of script
rm -rf sublist*
rm -rf filecopy.sh
#list all subtitle files and output into a txt file
find *.srt >> sublist.txt
find *.smi >> sublist.txt
find *.sub >> sublist.txt
/usr/bin/sed -i.bak 's/ /\\ /g' sublist.txt
#make copies of the sublist file for avi, mkv and mp4
cp sublist.txt sublistavi.txt
cp sublist.txt sublistmkv.txt
cp sublist.txt sublistmp4.txt
#replace subtitle extension from filenames with video extension, avi, mkv, mp4
/usr/bin/sed -i.bak 's/.srt/.avi/g' /Users/XXXUSERXXX/Downloads/sublistavi.txt
/usr/bin/sed -i.bak 's/.sub/.avi/g' /Users/XXXUSERXXX/Downloads/sublistavi.txt
/usr/bin/sed -i.bak 's/.smi/.avi/g' /Users/XXXUSERXXX/Downloads/sublistavi.txt
/usr/bin/sed -i.bak 's/.srt/.mkv/g' /Users/XXXUSERXXX/Downloads/sublistmkv.txt
/usr/bin/sed -i.bak 's/.sub/.mkv/g' /Users/XXXUSERXXX/Downloads/sublistmkv.txt
/usr/bin/sed -i.bak 's/.smi/.mkv/g' /Users/XXXUSERXXX/Downloads/sublistmkv.txt
/usr/bin/sed -i.bak 's/.srt/.mp4/g' /Users/XXXUSERXXX/Downloads/sublistmp4.txt
/usr/bin/sed -i.bak 's/.sub/.mp4/g' /Users/XXXUSERXXX/Downloads/sublistmp4.txt
/usr/bin/sed -i.bak 's/.smi/.mp4/g' /Users/XXXUSERXXX/Downloads/sublistmp4.txt
#create shell script to move video and subtitle files
cat sublist.txt sublistavi.txt sublistmkv.txt sublistmp4.txt > sublist2.txt
/bin/cat /Users/XXXUSERXXX/Downloads/sublist2.txt | while read line; do /bin/echo "mv /Users/XXXUSERXXX/Downloads/""$line" "/Users/XXXUSERXXX/Downloads/to.sort/" ; done>/Users/XXXUSERXXX/Downloads/sublist3.txt
/usr/bin/sed -i.bak 's/ /\\ /g' /Users/XXXUSERXXX/Downloads/sublist3.txt
/usr/bin/sed -i.bak 's/\\ \/Users/ \/Users/g' /Users/XXXUSERXXX/Downloads/sublist3.txt
mv sublist3.txt filecopy.sh
chmod +x filecopy.sh
#execute shell script to move video and subtitle files