Export to TXT and sorting - some help needed


I previously wanted to use DANO's script and sort by date. Since then, and since noone seemed to know how this would work, I moved to a pure text-file export.

I want to create this when I am in my folder C:\music, scanning all the albums that I have (all in folders \artist\album) generating a list that looks like this example scan:

2007-09-19 - [Rock] Feist - Town Hall, NYC 2007-06-12 [Bootleg] (2007) [MP3 |182kbps| 127.44 MB]
2007-08-06 - [Soundtrack] OSTHans Zimmer - Rain Man (1988) [MP3 |192kbps| 43.22 MB]
2007-07-17 - [Tango] Various - Tango Album (Disc 2) (2006) [MP3 |196kbps| 134.81 MB]

I have 3 problems right now:

  1. I am replacing the %artist% field with 'Various' here in case the parent directory is named "Various". I would like to add the condition that if that directory's name is "Soundtracks" it should use 'OST' instead of artist. How can I add TWO conditions? (I have NOT used the Album Artist tag in my collection, so a workaround would be better)

Current setting generating above listing including the error that the artist still appears after 'OST' in the second album from top:

$if($eql($left(%_parent_directory%,11),Soundtracks),OST,)$if($eql($left(%_parent_directory%,7),Various),Various,%artist%) - %album%

  1. Some albums have several discs, like the last one in the listing. What happens is that since I am using %album% for the album title, it always depicts the last disc of a set, i.e. (Disc 2). Is there a way to only display the main part of the title, i.e. 'Tango Album', with "Disc 2" not appearing?

Alright, the above mentioned problems have been resolved by myself. If anyone needs someinfo, let me know. BUT the question remains: How can I limit inversely sorted loops?

3) Since I reversed the $loop function to sort starting at most recent additions, I went with the suggested method by Dano:


I added another loop (by artist) to achieve a good sorting mechanism. Problem is: if I only want the last 100 albums to appear in my list, I would usually say


but this makes the sorting not work anymore. Also, if I add this number after the additional $loop for artists MP3TAG reproducibly crashes. What would be a way to limit the output to 100 lines i.e. albums?

Thank you very much for your help.


I think the additional limit in $loop is only intended for fields which return the same content on several files, e.g. %album% whereas %_file_create_datetime_raw% is different for each file.

To limit the output you could try to check if the %_counter% is smaller than 100