# Reversing the order

**URL:** https://community.mp3tag.de/t/reversing-the-order/12707
**Category:** Support
**Created:** [November 17, 2011, 8:53pm UTC](https://community.mp3tag.de/t/reversing-the-order/12707 "2011-11-17T20:53:25Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![kfairris](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/k/41988e/32.png) [@kfairris](https://community.mp3tag.de/u/kfairris)
#### Post date: [November 17, 2011, 8:53pm UTC](https://community.mp3tag.de/t/reversing-the-order/12707/1 "2011-11-17T20:53:25Z")

</div>

I'm trying to export a list of mp3 tags into a template I've built for an XML file. The problem is that I need to reverse the order of the loop so they appear in the proper order. I've searched the forums and found a $reverse function, but I admit, I don't know where it goes. So for example:

```
$filename(New_export_file.xml,utf-8)<?xml version="1.0" encoding="UTF-8"?>
<rss 
    xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" 
    xmlns:media="http://search.yahoo.com/mrss" 
    version="2.0">
    <channel>
        <title>Real FamilyLife with Dennis Rainey</title>
        <description>Life may be hard... but the precepts of the LORD are right, giving joy to the heart (Psalm 19:8). Real FamilyLife with Dennis Rainey, provides godly wisdom for life&apos;s toughest questions.</description>
<link>http://www.familylife.com</link>
    $loop(%_filename_ext%)
            <item>
            <title>%title%</title>
            <description>%comment%</description>
            <link>http://www.familylife.com/page.htm</link>
            <enclosure url="http://d1ekldu2q29g.cloudfront.net/%_filename_ext%" length="%_file_size_bytes%" type="audio/mpeg"/>
            <pubDate>%pubdate%</pubDate>
            <itunes:duration>%_length%</itunes:duration>
            <itunes:author>%artist%</itunes:author>
            <itunes:explicit>no</itunes:explicit>
            <itunes:block>no</itunes:block>
            </item>
$loopend()
    </channel>
</rss>

```

Where shall I put the $reverse function? And would it look like $reverse(%\_filename%)? Thanks in advance for any help!

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [November 18, 2011, 9:55am UTC](https://community.mp3tag.de/t/reversing-the-order/12707/2 "2011-11-18T09:55:04Z")

</div>

> [@kfairris](#):
>
> ... I need to reverse the order of the loop so they appear in the proper order. I've searched the forums and found a $reverse function, but I admit, I don't know where it goes. ... Where shall I put the $reverse function? And would it look like $reverse(%\_filename%)? Thanks in advance for any help!

The Mp3tag scripting function **$reverse(x)** reverses the order of the characters in the string x.  
See also ...  
[https://docs.mp3tag.de/scripting](https://docs.mp3tag.de/scripting)

Do you want to get file names sorted in descending order in an export script?  
What's what you get when the file names are sorted in descending order?

The Mp3tag export scripting function **$loop() ... $loopend()** does only ascending sorting.

DD.20111118.1155.CET

---

<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: [February 9, 2026, 12:23pm UTC](https://community.mp3tag.de/t/reversing-the-order/12707/3 "2026-02-09T12:23:26Z")

</div>


