Moving to a specific folder/drive
Posted: 12 Sep 2014, 13:10
Hi guys, first post so please be gentle, I'd consider myself a n00b when it comes to filebot and it's automation and regexes/groovy code. Recently I've discovered its ability to move files to folders and then a specific disk based on the folder name using this example:
Now I've adapted it to take into account that I sort "The" to the end of folder names giving me this:
but now I've run into a further problem with the sorting, I need to be able to split the letter "S" into to different folders depending on the next letter in the word. For example if the series name began with Sa-Sm (i.e. Salem to Smallville) I need it to go to drive 1 and if it was So-Sz (i.e. Some Girls to Survivors) I need it to go to drive 2. I've been trying for hours to get it right, using various combinations of the lookahead command but I just can't seem to get it right. What am I missing out on/doing wrong?
Here is my actual code:
Thanks for any help you guys can give me, it is seriously appreciated.
Code: Select all
{n =~ /^(?i)[0-9a-f]/ ? 'X' : n =~ /^(?i)[g-t]/ ? 'Y' : 'Z'}:/TV/{n}/{episode}
Code: Select all
{n.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/) =~ /^(?i)[0-9a-f]/ ? 'X' : n.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/) =~ /^(?i)[g-t]/ ? 'Y' : 'Z'}:/TV/{n}/{episode}
Here is my actual code:
Code: Select all
{n.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/) =~ /^(?i)[0-9a-d]/ ? 'D:/Videos/TV Series/Part 1' : n.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/) =~ /^(?i)[e-i]/ ? 'D:/Videos/TV Series/Part 2' : n.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/) =~ /^(?i)[j-r]/ ? 'D:/Videos/TV Series/Part 3' : n.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/) =~ /^(?i)[s-z]/ ? 'D:/Videos/TV Series/Part 4' : ''}