Is there an export command that I can add to the xspf generator that will select all files, and sort them by filename in descending order? I want to reduce the chances for error since I'm going to be handing the process off to the operators soon.
Unfortunately, the %_filename% or %_path% don't appear to sort the files in the order of newest to oldest. That is why I use the screen layout sort of $loop(a).
The list of files defaults to before processing:
2012-02-05_Title
2012-02-12_Title
2012-02-19_Title
2012-02-26_Title
(new) 2012-03-05 - junk - Artist - Title
(new) 2012-03-02 - junk - Artist - Title
(late arrival) 2012-03-04 - junk - Artist - Title (2012-03-06 arrival)
(new) 2012-03-06 - junk - Artist - Title
(replacement) 2012-03-02 - junk - Artist - Title
The action file I have converts the names to the right format, and places the tags, but the sort is still incorrect.
I need the output sort to be this way (newesst to oldest).
2012-03-06_Title
2012-03-05_Title
2012-03-04_Title
2012-03-02_Title
...
$loop(%_filename%) and $loop(%_path%) sort by filename and path.
The problem seems to be your (new) / (late arrival) / (replacement) expressions in your filenames. These crash your own system for sorting after date.
try: $loop($regexp(%_filename%,^\D+(\d),$1))
that should ignore everything before the first number
I don't know what these date means, but maybe these placeholder can also help you for sorting your files:
%_file_create_date% Short creation date
%_file_create_datetime% Long creation date
%_file_mod_date% Short modification date
%_file_mod_datetime% Long modification date
EDIT:
sorting from newest to oldest is complicated as you have to reverse the sorting.
If you can extract the numbers, it is possible.
$loop($sub(99999999,$regexp(%_filename%,.?(\d\d\d\d)-(\d\d)-(\d\d).,$1$2$3)))
This should work if all files have the date in the YYYY-MM-DD format somewhere in the title. For files which have the more that one date (like I see it in your example) the first date will be taken for sorting. If you want the second date, leave the ? away in the $loop string.
Thanks for your help on this. The $loop($sub.... worked in the test run. I'll try it on the production script later. I think I might just save the output to a filesorting feild for later use too.
Sorry the second date added confusion. I was orriginally planning to show why I can't count on the placeholders. I forgot to delete that part of the line.
All I can go on is the information provided in the filenames, which thankfully is always the same pattern.
After the action script runs. The filenames are just CodeDate_Title.