# Sort by folder year Z-A first THEN by filename A-Z

**URL:** <https://community.mp3tag.de/t/sort-by-folder-year-z-a-first-then-by-filename-a-z/59114>\
**Category:** Support\
**Created:** [November 19, 2022, 3:18pm UTC](https://community.mp3tag.de/t/sort-by-folder-year-z-a-first-then-by-filename-a-z/59114 "2022-11-19T15:18:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lakecityransom](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/94ad74/32.png) [@lakecityransom](https://community.mp3tag.de/u/lakecityransom)\
**Post date:** [November 19, 2022, 3:18pm UTC](https://community.mp3tag.de/t/sort-by-folder-year-z-a-first-then-by-filename-a-z/59114/1 "2022-11-19T15:18:25Z")

</div>

I have struggled to get 2-column sorting to work properly. I've researched and found the common answer is to make a custom column with a sort by set to %column A% %Column B%. This sort of works, but the ordering isn't good in my circumstance.

So in my case I sort by **pathing** and then **filename** and it comes out like this:  
2020\bandA - songA  
2020\bandB - songB  
2021\bandC - songC  
2021\bandD - songD

or I can sort the column in reverse and get this:  
2021\bandD - songD  
2021\bandC - songC  
2020\bandB - songB  
2020\bandA - songA

The problem is, I'm looking for the entirety of the sort to be displayed in this order:  
2021\bandC - songC  
2021\bandD - songD  
2020\bandA - songA  
2020\bandB - songB

So the problem I have is year folder should always have precedence before filename (I use artist -title). Is there any sane way to do this?

---

<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 19, 2022, 3:26pm UTC](https://community.mp3tag.de/t/sort-by-folder-year-z-a-first-then-by-filename-a-z/59114/2 "2022-11-19T15:26:51Z")

</div>

First click on the column with the filename, then click on the column with the YEAR.

---

<div class="post-metadata">

**Author:** ![lakecityransom](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/94ad74/32.png) [@lakecityransom](https://community.mp3tag.de/u/lakecityransom)\
**Post date:** [November 19, 2022, 3:35pm UTC](https://community.mp3tag.de/t/sort-by-folder-year-z-a-first-then-by-filename-a-z/59114/3 "2022-11-19T15:35:36Z")

</div>

I'm not using the year column, because the folder is named after a year to designate when I found the songs chronologically. I try to Click Path and then Artist column but it will only sort by 1 or the other. Effectively what I'm doing is building chronological playlists by year songs A-Z. Not by song release years.

---

<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 19, 2022, 3:40pm UTC](https://community.mp3tag.de/t/sort-by-folder-year-z-a-first-then-by-filename-a-z/59114/4 "2022-11-19T15:40:24Z")

</div>

The path is already unique. So you will get only 1 order.  
If you have the year in the property \_DRIECTORY, add this column to sort by.

---

<div class="post-metadata">

**Author:** ![lakecityransom](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/94ad74/32.png) [@lakecityransom](https://community.mp3tag.de/u/lakecityransom)\
**Post date:** [November 19, 2022, 4:09pm UTC](https://community.mp3tag.de/t/sort-by-folder-year-z-a-first-then-by-filename-a-z/59114/5 "2022-11-19T16:09:49Z")

</div>

The simplest way I can describe the issue is that:

1. Years folders will sort oldest - newest because 2020 \< 2021 and I prefer it to be newest first which is Z - A ordering
2. Artist - Song is preferable to be sorted A - Z

A column of path then filename _almost_ works, except if you sort by 2021 folder first, you'd get Z - A song ordering. If I create a special sort it doesn't help me overcome this problem. There is reverse ordering being paired between 2 columns and I need it to take folder precedence always before sorting the songs. I tried: %\_folderpath%%\_filename% but then I have to sort A-Z and go to the bottom and pull out 2021, move up, pull out 2020, etc.

The best way I could explain this problem is in the OP.

---

<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 19, 2022, 4:52pm UTC](https://community.mp3tag.de/t/sort-by-folder-year-z-a-first-then-by-filename-a-z/59114/6 "2022-11-19T16:52:36Z")

</div>

> [@lakecityransom](#):
>
> tried: %\_folderpath%%\_filename%

Please: add a column for \_DIRECTORY.  
Sort by \_FILENAME or TITLE so that this is in the right order  
Then sort by the column for \_DIRECTORY (which should contain the year data)

---

<div class="post-metadata">

**Author:** ![lakecityransom](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/94ad74/32.png) [@lakecityransom](https://community.mp3tag.de/u/lakecityransom)\
**Post date:** [November 20, 2022, 12:11pm UTC](https://community.mp3tag.de/t/sort-by-folder-year-z-a-first-then-by-filename-a-z/59114/7 "2022-11-20T12:11:37Z")

</div>

Thanks, I think that was the right info given the info I provided. It was a little more complicated, I had same-named subfolders of rating numbers as well that caused a bad sorting. However, it lead me to the ultimate answer. All that was required was:  
value   
field   
sort by %\_directory%

... and then sorting the result column descending. Then the Z-A order gets paired to the A-Z song order.

---

<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 20, 2022, 12:12pm UTC](https://community.mp3tag.de/t/sort-by-folder-year-z-a-first-then-by-filename-a-z/59114/8 "2022-12-20T12:12:36Z")

</div>

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