• Welcome to SCdev.org. Please log in.

Welcome to the new SCdev forums!

FatSort alternative?

Started by pootang, February 07, 2006, 07:51:59 AM

Previous topic - Next topic

pootang

Hi,

Just want to know if there is an alternative to fat sort. What I want to do is put a batch file on my sd card, so that when i'm finished copying files over to my sd card i just double click the batch file which sorts my folders and files alphabetically

is there such thing and is this possible? i'm sick of running the gui based app each time i copy something new to my sd card

cheers,
pootang

mr_jrt

More to the point...why doesn't romman just make the directory list sorted! It takes what, 3 lines of C++ code (yes I know using c++ for the firmware would be stupid, just illustrating my point). Even just a simple quicksort in C isn't that big and is mind-numbingly easy to do.

acky

Quote from: "mr_jrt"More to the point...why doesn't romman just make the directory list sorted! It takes what, 3 lines of C++ code (yes I know using c++ for the firmware would be stupid, just illustrating my point). Even just a simple quicksort in C isn't that big and is mind-numbingly easy to do.
By quicksort you mean the actual sort routine? Reference: http://www.cs.iupui.edu/~aharris/n301/alg/tmcm-java-labs/xSortLab/index.html

I don't see how you can write an algorith for that in three lines of any language (unless it's a native function).

bitblt

I use windows explorer to sort the files on my SD.  After you copy all the files to your sd, sort them any way you want with explorer.  Then cut and paste them (it's fast!) to a different folder on the SD.  When you look in the supercard menu, they will be sorted.

mr_jrt

Yes, sorting in C++ is part of the STL (Standard Template Library). Completely unsuitable for a highly limited firmware such as this, as I said.

The point I was making however was that a sort function isn't hard to write at all, so why settle for the pointless rewriting of directories just to get them sorted when its trivial to just sort them when the directory is opened!

...also has the minor side benefit of not wasting the write cycles on the media either.

bitblt

Bubble sort can be hard coded in one small nested loop. Rommans list is sorted in the order files are copied to the SD (entered in FAT).  If you try the trick I mentioned, windows explorer will re-sort the FAT.

Yautja

so how would we use bubble sort??

bitblt

i was refering to . . .

Quote from: "mr_jrt"Yes, sorting in C++ is part of the STL (Standard Template Library). Completely unsuitable for a highly limited firmware such as this, as I said.

Bubble sort can be hard coded in one small nested loop.

Quote from: "Yautja"so how would we use bubble sort??

You don't need STL sort or bubble sort, just use explorer.

Yautja

ah i see
so just use explorer to sort them

mr_jrt

...and the point I was making was what bloody use is just walking through the FAT directory listing printing out the filenames other than just being lazy about it? Read the directory listing, sort the entries, presto magico, useful list.

It's not so much that the firmware sorts the files by the order they're copied to the card, as thats the raw order of the FAT directory entries! I once wrote code to work with a FAT & its directory listings into a 512 byte bootloader, it really is quite possibly one of the simplist formats in the world. That, though, i irrelevant as its sorting which I'm try to convince you about. Badly, it would seem. Either alphabetical or by decending & ascending modified dates are the most useful options, IMHO. It'd be nifty if the Supercard modified the last access field..though that would probably waste write cycles too, so is probably unsuitable.

bitblt

I agree, it would all be nifty. Maybe Romman will implement a simple sort in the future?  A touch interface would also be nice.

In the meantime try using the explorer trick.