How do I reorder files in a directory?

Hi -

So I just bought a new flash mp3 player, and when I copy music directories onto it the songs are in a relatively random order. A little research lead to the discovery that the player displays the songs in the order that they are copied onto it; not sorted either alphabetically or using the track number prefix on each file.

So, I compared the directory on my computer with that on the player using “ls -U” and sure enough the order is the same (seemingly arbitrary), and not sequential by name.

So, is it possible to reorder the songs in the directory so that when I drag and drop it on the player they will be in the proper track order?


  • John

The only way I know is to copy them onto the FAT filesystem in the order you want. This may not happen from D+D but does work from the CLI. Or use a playlist, if your player supports it.

Yup. There are few scripts floating around that purport to do this, but none seem to work with long filenames. The utility fatsort (Homepage of FATSort Utility) gets the job done, but having to apply it to the mp3 player after copying the files is rather inconvenient. Still, better than nothing.


i’ve not tried it, but might wanna:

rename each tune/track’s file like this

originalNameFifthTrack.mp3 05.originalNameFifthTrack.mp3
originalNameFirstTrack.mp3 01.originalNameFirstTrack.mp3
originalNameFourthTrack.mp3 04.originalNameFourthTrack.mp3
originalNameSecondTrack.mp3 02.originalNameSecondTrack.mp3
originalNameThirdTrack.mp3 03.originalNameThirdTrack.mp3

then, i think if you copy the files into your player they will be
ordered as they are on your original CD…if not you may have to first
move the files to a NEW directory on your hard drive, and then copy to
the player…

and, if you wanna dump several CDs into the player and and have the much
come out as if you were playing one CD after another you just need to
also lead each title with some sort of CD name…like maybe give one CD
from SomeGroup the name 01SG, and another from that same group as 02SG,
and maybe DifferentGroup could have 01DG, 02DG, etc etc etc

and, using THAT convention when you got ready to load your player you
could just “throw” all the files from the different CDs into one new
temporary directory and they would automatically order them selves like this

… etc
… etc
… etc
… etc

i think.

DenverD (Linux Counter 282315)
A Texan in Denmark