[Windows] Splitting alphabet when sorting to different drives

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
failstyle420
Posts: 9
Joined: 08 Sep 2014, 10:26

[Windows] Splitting alphabet when sorting to different drives

Post by failstyle420 »

Ok, so I recently discovered you can sort files into different disk drives and hacked the example found here on the site:

Code: Select all

{n =~ /^(?i)[0-9a-s]/ ? 'D' : n =~ /^(?i)T[hea-z]/ ? 'E' : 'D'}:/Movies/{n} ({y}) ({source})/{n.colon('-')} ({y}){if (ext == 'srt') '.eng'}
What I want to do is have "0-9 A-The " go to D drive and "Thea-Z" go to E drive. This works for the most part except for:

1. This doesn't work correctly for movies that have a number immediately after the first letter, such as:
-T2 Trainspotting (2017) (This actually works, but only because of where I have T's located)
-X2 - X-Men United (2003)

2. Anyway to go further than the second letter when splitting the alphabet, it seems to stop at T[h-z].
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Windows] Splitting alphabet when sorting to different drives

Post by rednoah »

You can use < and > to check lexicographical order like this:

Code: Select all

{n < 'The Ω' ? 'A' : 'Z'}
:!: This is a simple example. You may need to make changes to make it work the way you want for all your corner cases.
:idea: Please read the FAQ and How to Request Help.
failstyle420
Posts: 9
Joined: 08 Sep 2014, 10:26

Re: [Windows] Splitting alphabet when sorting to different drives

Post by failstyle420 »

Thank you for the quick response and I'll see what I can do to get it to work, if not I can simply move all the movies with Th to the other drive and work the code as is!
I'm barely proficient with windows cmd, so wish me luck :P
Post Reply