Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Help reqd with file move-to preset pattern (Read 2981 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Help reqd with file move-to preset pattern

Hi,
I'm trying to optimize my file move-to preset pattern to easily sort my files into the following folder structure:
\<initial>\<artist>\<artist> - <title>.mp3
And all artists with 'The ' should be sorted in the actual letter of the band name and everything not starting with a letter should be sorted into the folder '#' (e.g. the artist !DEL or 12 Stones or 50 Cent should all be in one directory and not in the directories '!', '1' and '5' respectively).

My current pattern is this:
Code: [Select]
$cut($swapprefix(%artist%,'The'),1)/$swapprefix(%artist%,'The')/%artist% - %title%


I've succeeded with all, except for the artists not starting with a letter. I need to be able to test if the value of the first character is a letter and if not sort it into '#' otherwise sort it regularly.
Does anyone have an idea of how I can test if the first letter is not a-z or A-Z without having to build in 26 if checks?

Thanks in advance.

 

Help reqd with file move-to preset pattern

Reply #1
Code: [Select]
$if($strchr(abcdefghijklmnopqrstuvwxyz,$lower($put(a,$cut($stripprefix(%artist%),1)))),$get(a),#)\$swapprefix(%artist%)\%artist% - %title%

Help reqd with file move-to preset pattern

Reply #2
Code: [Select]
$puts(Initial,$lower($cut($swapprefix(%artist%,'The'),1)))
$ifgreater($strchr(abcdefghijklmnopqrstuvwxyz,$get(Initial)),0,$get(Initial),'#')/$swapprefix(%artist%,'The')/%artist% - %title%



[edit]Crap. Your code is better, too.
elevatorladylevitateme

Help reqd with file move-to preset pattern

Reply #3
Code: [Select]
$if($strchr(abcdefghijklmnopqrstuvwxyz,$lower($put(a,$cut($stripprefix(%artist%),1)))),$get(a),#)\$swapprefix(%artist%)\%artist% - %title%


Nice, works like a charm. Thank you very much for the quick reply!

Help reqd with file move-to preset pattern

Reply #4
Very nice! Didn't know that you can use the $put-function inside of another titleformatting function.