# Sort by file name then by track number

**URL:** https://community.mp3tag.de/t/sort-by-file-name-then-by-track-number/10870
**Category:** Support
**Created:** [September 26, 2010, 7:38pm UTC](https://community.mp3tag.de/t/sort-by-file-name-then-by-track-number/10870 "2010-09-26T19:38:41Z")
**Posts on this page:** 1
**Showing post:** 6

<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: [September 28, 2010, 5:53am UTC](https://community.mp3tag.de/t/sort-by-file-name-then-by-track-number/10870/6 "2010-09-28T05:53:29Z")

</div>

> [@0LD3 DUDE](#):
>
> ... If I click track to order them numerically, then click Artist, ...

The column dialog of the Mp3tag list view allows to enter a _user defined_ sort criterium per column.

Example:  
Column Name: **Album**  
Column Value: **$meta\_sep(album,'\\')**  
Column Field: **%album%**  
Column Sort By: **%album%%discnumber%%track%%title%**  
Column Numeric: **no**

This will reduce the steps of sorting other columns in order to get the sorting by wish to one click (maybe two clicks for descending sorting).

Read about how to customize columns in the manual.  
[https://docs.mp3tag.de/customization/file-list](https://docs.mp3tag.de/customization/file-list)

DD.20100928.0953.CEST

Be aware that this sorting expression is "quick and dirty", and does not sort correct in all cases.  
In order to get a better sorting result you need to do some column sizing like ...  
Column Sort By: **$left(%album%$repeat(' ',50),50)$right($repeat(' ',3)%discnumber%,3)$right($repeat(' ',7)%track%,7)$left(%title%$repeat(' ',100),100)**

DD.20101015.1757.CEST

I pointed out above, that a Column Sort expression of ...  
**%album%%discnumber%%track%%title%**  
... might _not sort correct in all cases_.

I proposed a fixed size Column Sort expression, which provides a better guarantee to do a reliable sorting. But the expression for itself looks complicated, and the prediction of the fixed size column width might be predicted _to fail for one special case some day_ and it costs computer memory resources.

It might be possible to permit dynamic length per tag-field, when the individual tag-fields are delimited by a special character, respectively by a special character sequence, which is _impossible to occur in the tag-field content_.

Something like this should be coded ...  
Column Sort By: **%album%'-|?|-'%discnumber%'/|/'%track%'_+_+\*'%title%**  
... or this ...  
Column Sort By: **%album%$char(7)%discnumber%$char(7)%track%$char(7)%title%**

DD.20110428.0800.CEST

---

_[View the full topic](https://community.mp3tag.de/t/sort-by-file-name-then-by-track-number/10870)._
