# Magic sort order of DOS DIR command

**URL:** https://community.mp3tag.de/t/magic-sort-order-of-dos-dir-command/6447
**Category:** Off-Topic
**Created:** [March 14, 2008, 7:24am UTC](https://community.mp3tag.de/t/magic-sort-order-of-dos-dir-command/6447 "2008-03-14T07:24:48Z")
**Posts on this page:** 3
**Page:** 1

<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: [March 14, 2008, 7:24am UTC](https://community.mp3tag.de/t/magic-sort-order-of-dos-dir-command/6447/1 "2008-03-14T07:24:48Z")

</div>

Magic sort order of DOS DIR command

This is output from Mp3tag Cover Export.

Yesterday I got following situation, see sort order of files, incorrect output on option /o-dne.

```
O:\TEST\COVERS>dir 1*.* /odne

13.03.2008 20:34 5.286 1.jpg
13.03.2008 20:34 7.813 1(1).jpg
13.03.2008 20:34 3.475 1(2).jpg
               3 Datei(en) 16.574 Bytes

O:\TEST\COVERS>dir 1*.* /o-dne

13.03.2008 20:34 7.813 1(1).jpg
13.03.2008 20:34 3.475 1(2).jpg
13.03.2008 20:34 5.286 1.jpg
               3 Datei(en) 16.574 Bytes

```

Today, with newly created files, I got following situation, see sort order of files, correct output on option /o-dne.

```
O:\TEST\COVERS>dir 1*.* /odne

14.03.2008 09:16 5.286 1.jpg
14.03.2008 09:16 7.813 1(1).jpg
14.03.2008 09:16 3.475 1(2).jpg
               3 Datei(en) 16.574 Bytes

O:\TEST\COVERS>dir 1*.* /o-dne

14.03.2008 09:16 3.475 1(2).jpg
14.03.2008 09:16 7.813 1(1).jpg
14.03.2008 09:16 5.286 1.jpg
               3 Datei(en) 16.574 Bytes

```

So what the heck is going on there?

DD.20080314.0924.CET

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [March 14, 2008, 3:34pm UTC](https://community.mp3tag.de/t/magic-sort-order-of-dos-dir-command/6447/2 "2008-03-14T15:34:41Z")

</div>

You could check the entire D (Date/Time). In my german DOS, the help shows the following explanation:

> [@](#):
>
> D Datum/Zeit (ältere zuerst)

I think your files have some additional (but not visible) information in the time: The seconds.  
Maybe this seconds make the difference in sort order?

---

<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: [March 15, 2008, 3:18pm UTC](https://community.mp3tag.de/t/magic-sort-order-of-dos-dir-command/6447/3 "2008-03-15T15:18:43Z")

</div>

> [@LyricsLover](#):
>
> You could check the entire D (Date/Time). ...

This is what I did, see option /o-dne, that means sort by date in reverse order.

Could it be that the filesystem registers two files at the identical time point, when they were created in sequence one after another by Mp3tag cover export?

DD.20080315.1717.CET

I checked it again and see what happened:

```
O:\TEST\COVERS>dir *.* /od

15.03.2008 18:08 3.475 1(2).jpg
15.03.2008 18:08 7.813 1(1).jpg
15.03.2008 18:08 5.286 1.jpg
15.03.2008 18:08 22 identify.in.txt
15.03.2008 18:08 4.110 Mp3tag.magick.identify.cmd
15.03.2008 18:11 <DIR> ..
15.03.2008 18:11 <DIR> .

O:\TEST\COVERS>dir 1*.* /od

15.03.2008 18:08 3.475 1(2).jpg
15.03.2008 18:08 5.286 1.jpg
15.03.2008 18:08 7.813 1(1).jpg

```

Identical sort order /od using different search masks gives different sort results.

Looks like a DOS bug.

DD.20080315.1822.CET
