Fenux.Net - The Life of a Geek
FAT Sorter v1.0.4
Coding
Posted on 4/21/2008 4:27 pm in Coding

What is it?

A "simple" program to sort files on a FAT file system. The target scenario for it is to sort the files and folders on a USB flash drive alphabetically, so they are loaded properly on devices that read them.

But why?

I bought a cheap car stereo about a year ago that plays MP3 files from either CD or from a USB flash drive or a compact flash memory card. However, it plays them in the order that they were added to the device.

Sometimes, Windows doesn't copy the files over in the right order, or if files are added at a later date, they stay at the end. When I listen to full albums in the car, it bugs me when they play out of order.

I searched around for a utility to correct the problem, but none of them supported recursion of subfolders. So I decided to make one.

Why it is necessary

The FAT file system doesn't support sorting directory entries. However, this is the only file system for USB flash drives that is widely supported. Unless the hardware or software accessing the device (like your computer) resorts them for display, the files will show in the order they were added to the directory.

How we get around it

To get around the problem, we cheat. By making a temporary directory, moving all the files to it, and then moving them back, in the new order, we effectively resort the directory. We then repeat the process in each directory listed. Sorter does this in reverse order, but not for any reason other than it makes the progress bar more accurate, because it knows how many files are there before it starts.

Why do you say it's a "simple" program

The actual sorting process is fairly straight forward. However, it offered me an excuse to play with technologies I hadn't gotten to use yet, like WPF (Windows Presentation Framework) and threading. I've also added basic support for localization, but as I don't speak any other languages, I haven't made any translations for it. With all that in mind, the program ended up quite a bit more complicated than necessary, but it doesn't hurt anything.

What does it require?

The program requires Windows XP or later and the .NET Framework 3.5. It will allow you to download the framework when you install it, so you don't have to install it beforehand.

Where can I get it?

You can download the file directly here. It also includes (most of) the source code for the program, if you want to take a look. I've released it as open source (see the included license for details).

18 responses to FAT Sorter v1.0.4

Page 1 of 2
[No subject]
Sometimes it doesn't work as expected. Need to sort more than one time. Guess when there are too many files. Do you mind why ? Thanks for the utility...
Posted: Aug 29th, 08:58 by Anonymous
FAT Sorter
After much head scratching your download solved by mixed up music issue in seconds.\nI have been using an SD card with loads of albums and plugging into my car head unit, all is now as it should be, alphabetical and in track order.\nMany Thanks, I am VERY grateful to you.
Posted: Aug 24th, 12:06 by Fouldsy
This is a great progam
more than useful. For the first time I can enjoy the music on my stick!
Posted: Aug 18th, 14:30 by Ban DeLe
[No subject]
Just thought I'd let you know that uses are being found for this little beauty, in the hombrew scene, as can been seen here http://forums.xbox-scene.com/index.php?showtopic=700896&st=120\n\nThanks :)
Posted: Aug 17th, 18:13 by DARKFiB3R
FAT Sorter
Bloody brilliant - and so easy. Thanks a million. R
Posted: Jul 24th, 06:34 by Ro
[No subject]
GREEEEAAATTTT !!\n\nI use your program to sort alphabeticaly the MP3 of my USB key, in order to read them with my car stereo.\nIt Works as well for any mp3 player.\n\nThis prog is the jewell I had been looking for MONTH !! I guess it would be usefull for millions of people ! Market it !!
Posted: Jul 18th, 12:32 by Phil
Excellent!
I'm learning english, so that I need mp3 to sort well. It's very helpful. Thanks a lot!
Posted: May 29th, 10:01 by Brook
Brilliant utility!
Bought a Sony USB mp3 car stereo and was annoyed with the order it navigates through the folders on the stick. Came across this utility and now all my folders and files are sorted in the proper alphabetical way! Thanks a million, this is a gem of a program!
Posted: Jan 12th, 06:03 by Spoon
Works Great
I use it to sort .avi s on my usb key, it sorts them great! Very easy to use
Posted: Jan 1st, 18:56 by Keith
[No subject]
Needed a couple of runs to fully sort but seems to have worked (looks like a broken Quicksort, I got "N-Z, A-M" first time round)\n\nTo the guy who can't get the sub dirs checkbox to check - the author made the colour of tick VERY light grey on white background. Look real close when you click (and maybe the author will sort his colours out :) )
Posted: Dec 23rd 2009, 15:56 by Matt
Thanks!
Awesome! Thank you! I cant stand having 4 days of (In order) music that plays completely out of order.\nYou say you just moved them to where they needed to be in order? I should write something like this for linux. I'd bet I could do it in bash. =)\nHuge help, I'm rushing out the door but needed a sort.
Posted: Nov 25th 2009, 17:22 by NRot
Fat Sorter
This works very well. Thanks for your effort and kindness in providing this tool free. Very rare these days...
Posted: Nov 13th 2009, 05:28 by John 'Appreciative'
stand alone -- no installer?
I don't like installers so I usually install into a virtual machine and extract IFF I determine it is unlike to also not create registry bloat\n\nyou're msi contains some interesting non-salvageable content\n\nhttp://drop.io/fatinsidefat\n\n:(
Posted: Nov 3rd 2009, 11:11 by unhappy I am with this
[No subject]
Excellent utility! Exactly what i needed. Thank you very much.
Posted: Oct 26th 2009, 09:32 by Tomo
long filename support using FAT32
I need to sort on long filenames on a FAT32 SDHC card.\nAfter sorting the order is still: 'messed up'.
Posted: Sep 5th 2009, 09:16 by Anonymous
Page 1 of 2
Creative Commons License  Subscribe with Bloglines  Get Daily Wisdom!
This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.
© 2000-2010 Jason Burgess