# Export to File (Order)

**URL:** https://community.mp3tag.de/t/export-to-file-order/66622
**Category:** Support
**Created:** [November 25, 2024, 7:45am UTC](https://community.mp3tag.de/t/export-to-file-order/66622 "2024-11-25T07:45:19Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mista\_j](https://community.mp3tag.de/user_avatar/community.mp3tag.de/mista_j/32/15808_2.png) [@mista\_j](https://community.mp3tag.de/u/mista_j)
#### Post date: [November 25, 2024, 7:45am UTC](https://community.mp3tag.de/t/export-to-file-order/66622/1 "2024-11-25T07:45:19Z")

</div>

I have an action that is exporting Track numbers to a .txt file.  
They are exporting properly but not in the order I was expecting. In mp3tag the files are listed in track order starting from 1. I selected all the files of one album & the txt file is set for something like

$IF($eql(%Variable%,'YES'),%TRACK%,•NO•)

The resulting text file is along the lines of

8  
•NO•  
1  
•NO•  
13  
•NO•  
...

Why is the list not in order? I was expecting

1  
•NO•  
•NO•  
•NO•  
•NO•  
•NO•  
•NO•  
8  
•NO•  
•NO•  
•NO•  
•NO•  
13  
...

I was planning on concatenating these track numbers in order. The end goal was: 1,8,13...

Just trying to figure out what pattern mp3tag is following here, either that or a way to sort these again if they will be randomized each time I export

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [November 25, 2024, 7:50am UTC](https://community.mp3tag.de/t/export-to-file-order/66622/2 "2024-11-25T07:50:09Z")

</div>

Please show us the export script - otherwise it is very tricky to get an idea.

Just a wild guess:  
Check the $loop() statement which sort the tracks.  
That should read $loop($num(%track%,2)).  
Sorting is always alphabetical, not numerical.

---

<div class="post-metadata">

### Author: ![mista\_j](https://community.mp3tag.de/user_avatar/community.mp3tag.de/mista_j/32/15808_2.png) [@mista\_j](https://community.mp3tag.de/u/mista_j)
#### Post date: [November 25, 2024, 9:14am UTC](https://community.mp3tag.de/t/export-to-file-order/66622/3 "2024-11-25T09:14:36Z")

</div>

$filename(txt,utf-8)$loop(%\_path%)$IF($EQL(%BINC1%,%Cover Description 1%%FC Suffix%),%TRACK%,•NONE•)  
$loopend()

Somehow I always imagined it just exported in the order the files were in when viewed in mp3tag

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [November 25, 2024, 9:16am UTC](https://community.mp3tag.de/t/export-to-file-order/66622/4 "2024-11-25T09:16:51Z")

</div>

> [@mista\_j](#):
>
> Somehow I always imagined it just exported in the order the files were in when viewed in mp3tag

Then you have to use $loop(1) - and no variable that gets sorted.

---

<div class="post-metadata">

### Author: ![mista\_j](https://community.mp3tag.de/user_avatar/community.mp3tag.de/mista_j/32/15808_2.png) [@mista\_j](https://community.mp3tag.de/u/mista_j)
#### Post date: [November 25, 2024, 9:25am UTC](https://community.mp3tag.de/t/export-to-file-order/66622/5 "2024-11-25T09:25:20Z")

</div>

Ahh, yeah that did it! THANK YOU.

I'll be honest I don't remember making the original export script I just duplicate it & edit the new one each time I need a script. So long as I was able to get the information over there in all my other cases I was fine

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [December 25, 2024, 9:25am UTC](https://community.mp3tag.de/t/export-to-file-order/66622/6 "2024-12-25T09:25:47Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
