File sort order

Electronics Computer Programming Q&A
Post Reply
User avatar
Lenp
Posts: 1316
Joined: Thu Oct 26, 2006 7:11 pm
Location: Maryland
Contact:

File sort order

Post by Lenp » Wed Aug 20, 2014 2:10 am

Easy question, but maybe a hard answer...

How are files actually sorted on a drive?
With Windows Explorer, and DOS, you can view files sorted differently but in what order are they really stored?

In DOS with the DR /b (Bare) option they are shown in file name alpha order, but is that just a viewing convention or the real storage order?

This is relevant only because I am creating a large number of sound files that I want to play from a flash drive in a set order.
These will be played by a 'dumb' USB player that likely does not recognize a play list. It just starts with the first file and goes on through the list.

Online searching so far has yielded mass obscureia!!

Thanks,
Len
Len

“To invent, you need a good imagination and a big pile of junk.” (T. Edison)
"I must be on the way to success since I already have the junk". (Me)

User avatar
CeaSaR
Posts: 1620
Joined: Sat Nov 08, 2003 1:01 am
Location: Phoenixville, PA USA
Contact:

Re: File sort order

Post by CeaSaR » Wed Aug 20, 2014 2:44 am

Files are stored in FCFS order (First Come First Served). And the files are not contiguous, which is why Defrag was invented. So, the drive looks for an open block to start writing the file. It doesn't matter to the drive if that block is big enough to hold the whole file, it just skips on to the next available piece of "real estate", and so on, and so on, until it is done writing the file. All the pointers to each piece of the file are srored in the drive's TOC.

As for your MP3 player, the files will be in the order they are copied, if done one at a time. Mass copy n paste is an all bets are off deal.

And your player may have a default sort order. I have had several cheapies over the years and they were all different in their sort order. Hopefully, your player will be by physical placement.

CeaSaR
Hey, what do I know?

User avatar
Lenp
Posts: 1316
Joined: Thu Oct 26, 2006 7:11 pm
Location: Maryland
Contact:

Re: File sort order

Post by Lenp » Wed Aug 20, 2014 3:09 am

Hi CeaSaR
WOW that was fast..... I am surprised anyone else is up this early
I understand the directory drives structure and the VTOC's function to log the space, and that the files are saved in order of arrival, but, if you look at them in a DOS directory view, they are alpha sorted ?? Is the alpha sort a default of the DIR command?

Thanks,
Len
Len

“To invent, you need a good imagination and a big pile of junk.” (T. Edison)
"I must be on the way to success since I already have the junk". (Me)

User avatar
CeaSaR
Posts: 1620
Joined: Sat Nov 08, 2003 1:01 am
Location: Phoenixville, PA USA
Contact:

Re: File sort order

Post by CeaSaR » Fri Aug 22, 2014 4:41 pm

Hey Len!

Get up between 5-5:30 during the week. I need a little mental stimulation that early. LOL

It has been quite a while since I've used real DOS, but I recall using thr DIR command and seeing files in no particular order. Using the / D (date), / N (name) and whatever switch was used for (type), was how you got it to work to your wishes. So, I can only surmise it goes by the linear placement order of the TOC.

Sorry, my 386 is in storage and I don't have time to go through my "Running DOS 6.0" book tonight or tomorrow. Maybe Sunday if I can catch a breather.

CeaSaR
Hey, what do I know?

User avatar
Lenp
Posts: 1316
Joined: Thu Oct 26, 2006 7:11 pm
Location: Maryland
Contact:

Re: File sort order

Post by Lenp » Sat Aug 23, 2014 6:28 am

Hi
I think the commands are right and they should run n from a DOS box in Windows.

It does seem that the files, regardless of how they are viewed when sorted, play In a different order I noticed when you re-sort a group of files there does not seem to be any activity on the flash drive's LED so the resorting is likely not changed on the drive, just the presentation when it is viewed. It is not WYSIWYG it is WYSINWYG
Thus might explain the need for a play list for most audio players!

Years ago when the DOS version of Norton Utilities was the go-to software for disk operations you could see the actual file structure but I don't know of anything like that for the newer disk formats.

I am going to test to see if it is FIFO by loading a group of files one at a time.
As I play with it I'll post results
Thanks
Len
Len

“To invent, you need a good imagination and a big pile of junk.” (T. Edison)
"I must be on the way to success since I already have the junk". (Me)

User avatar
CeaSaR
Posts: 1620
Joined: Sat Nov 08, 2003 1:01 am
Location: Phoenixville, PA USA
Contact:

Re: File sort order

Post by CeaSaR » Sat Aug 23, 2014 7:17 pm

With these cheapies you never know at first how they will play the contents of the storage area. I have had 2 players that would play the contents in order just like your computer would. You could even specify sort order. Then the next one I had would seemingly randomly play with total disregard for file structure. It could start in the root and then skip around through folders and now that I think about it, it was playing the whole drive in alpha numeric order while completely disregarding the file structure and other folders / directories. And now this last one, I have not been able to listen completely to the end of all the songs because every time I would stop it or let it go to sleep for a while it would back up to a song that could have been 1, 5, 10, or some unimaginable number previous to where I had stopped.

Good luck, you'll need it. :shock:

CeaSaR
Hey, what do I know?

User avatar
Lenp
Posts: 1316
Joined: Thu Oct 26, 2006 7:11 pm
Location: Maryland
Contact:

Re: File sort order

Post by Lenp » Sun Aug 24, 2014 4:53 am

This is a piece of commercial audio gear that has FM/CD/MP3 features but it
looks like it's MP3 play mode is NARIO (Numerically Alphabetized Random Indifference Order)
Len
Len

“To invent, you need a good imagination and a big pile of junk.” (T. Edison)
"I must be on the way to success since I already have the junk". (Me)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests