Help with Export Option

Well, I have done this script:

$filename(txt,utf-8)$loop(%_path%)%_filename%
$loopend()

Pretty simple, isn't it? Well, that one serves me well, but now I want something that writes the name of the directory that the loop is working before the tracklist of that directory. I mean, in the above script, I get something like this:

Track1
Track2
Track3

What I wanna do is something similar to this:

DirectoryName1

Track1
Track2
Track3

DirectoryName2

Track1
Track2
Track3

Yes, a line break before and after the directory name will be awesome, but if that can't be made, it's fine just write all the lines one bellow another.

I'm not a English speaker, sorry for any trouble that you guys can have to understand me, but I will try my best to answer any question to provide more details and explanation, if needed.

Thank you so much for all the time reading my stupid question and even more to anyone that will try to solve this little issue of mine. Take care, see ya!

Try a nested loop

$filename(txt,utf-8)$loop(%_directory%)%_directory%
$loop(%_filename%)%_filename%
$loopend()
$loopend()
QUOTE (ohrenkino @ May 24 2017, 16:21) <{POST_SNAPBACK}>
Try a nested loop
$filename(txt,utf-8)$loop(%_directory%)%_directory%
$loop(%_filename%)%_filename%
$loopend()
$loopend()<!--QuoteEnd--></div><!--QuoteEEnd-->

Tested and worked very well! Thank you my friend, this will help me a lot. Now I can get a list of tracks of some folders that I need to send to cloud in a single TXT file to future search when the time to download some of them shows up or check if I already have that one.

Bye for now.