I’m starting a little project for myself which basically involves
reorganising the entries in a FAT/FAT32 table. My reason is simple. I
have a car stereo that reads SD cards, but will only play the songs in
the order that they appear in the file allocation table.
I know I should buy a better car stereo, but I’ve got a bit of time on
my hands right now and would like to see this through.
So, could anyone tell me how to access the entries in a FAT directly
with Ruby? Maybe C or C++ is better, but I haven’t used those in ages
and do not want to spend half a day pulling my hair out just relearning
Thank you all in advance
This may work for you.
Read the comments too…
Very fast. Thanks for the heads up.
Not sure which language he used. I have sent the author an email asking
for any help he may give.
I take it then Ruby is limited in this area?
Not sure I can committ to Ruby being limited in this area. Just know
do it in C/c++ from my experience…
Take a look here http://ruby-doc.org/core/classes/IO.html. Does not
hit the “DIRECTORY” (FAT) structure…
Interesting link: http://tronweb.super-nova.co.jp/t-enginefataccess.html
On Tuesday, July 20, 2010 01:26:28 pm Joseph E. Savard wrote:
Not sure I can committ to Ruby being limited in this area. Just know how
to do it in C/c++ from my experience…
Take a look here http://ruby-doc.org/core/classes/IO.html. Does not seem
to hit the “DIRECTORY” (FAT) structure…
Doesn’t seem like it could, really. I don’t know of any filesystem API
would make this clean.
One possible hack would be to move the files all to a temporary
the same device, then move them back, one at a time, syncing after each
That might force the directory order, but it might wear your SD card a
and I don’t know enough about FAT to know whether it’d do what you’re
If that doesn’t work, you’re going to need some sort of low-level access
(/dev/whatever on Unix) and a lot of binary manipulation (or a library).
don’t know that there’s anything for Ruby – maybe this in JRuby: