Export to txt, problem with $if statement

Here is my export script to txt (in attachment)

The problem is that I can't rid of «magic number» 4 in $if section.


It's not cross-functional. I think I need another $if there, but can't figure out what $if.
Hope I described the problem clearly.

Tried to replace 4 with %_directory% and it worked. But I'm doubt about this solution.

Oh, and another problem is:
I have empty strings between strings. :huh:

The first step in understanding the situation should be to check the syntax regarding pairs of round clambs.

The second step should be to check the part of the script where the $loop function has been used as an argument within the $ifgreater function. Does this really work?


My music collection looks like this:
Usually 4 folders.
The idea is: if path has more than 4 folders -> check this with this $if operator.