How to reorder the files of a FAT32 file system?

I have not tried this, but a google search lead to a result which seems almost perfect here. FAT-32 Sorter. It even describes pretty much exactly the problem you are having. I hope this helps.


It's not strange. Sorting the list requires "a lot" of memory, which may not be available on small embedded systems like MP3 players. You need a big enough array to store all the filenames before sorting them.

Therefore those systems just list the files in whatever order the directory entry stores its child items and remove the need for the array, since now you just load a single filename instead of the full directory listing.

You can manually sort the files by moving them to another directory in the order you want

If the storage medium is a FAT-formatted USB thumb drive, then the files will be enumerated in a complex order based on the order in which files are created and deleted and the lengths of their names. But the easy way out is simply to remove all the files from a directory then move file files into the directory in the order you want them enumerated. That way, the first available slot is the one at the end of the directory, so the file entry gets appended.

What order does the DIR command arrange files if no sort order is specified?

Or just use the tools made for this sorting purpose

  • mp3DirSorter
  • YAFS: Yet Another FAT Sorter
  • FAT Reader
  • FAT-32 Sorter
  • FAT Sorter
  • Sort MP3 Files On MP3 Player
  • https://github.com/maxpat78/FATtools

Another option that avoids the need for specific utility and allows you to set the sequence in any order you want, is to simply rename the files or folders on the FAT32 drive.

I have a USB flash drive I use in my car audio system (which plays files and folders in the order found on the drive) and I use this technique to set the order of the folders and thus the order that the audio system sees them.

My observation is that if a file or folder is renamed to a longer name, the directory entry is recreated at the end of the directory, and so would then appear to be last in the playing order. I can then rename it back to its original name and it will keep its new position. I then repeat this process with each folder or file until they are in the order I want. Start with the item you want second, then the item you want third and so on.

To make this process a bit less tedious, as small batch file can be used:

ren %1 %1-padding
ren %1-padding %1
dir

Tags:

Windows

Fat32