Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can i do a physical sort of files on disk

Status
Not open for further replies.

bookouri

IS-IT--Management
Feb 23, 2000
1,464
US
I have a project with dozens of PDF or other document files. If I copy a bunch of these files to a flash drive using windows explorer they end up in random physical order on the flash drive. As long as I look at the files in Explorer they are sorted by name, date, whatever. But if I go to a command window and do a dir, the files are in random order. Is there not a DOS command that will let me perform a physical sort on the drive so that these files are placed in order by file name rather than just tossed out there? I dont just want to view the files in order, i want them to physically reside on the drive in order.

can anybody point me in the right direction, can it be done with some DOS sort command, or some other utility?

thanks

 
This may be something to do with how files are actually written to devices such as CD's, Flash Drives or Hard Drive?

A Defragmentation of the Drive may help the files to be contiguous?

From DOS Command Prompt, looking at a Flash Drive, the file sort order seems to be alphabetically by Directory with the files in each Directory being also sorted alphabetically, this may give the appearance of a haphazard order?

Why defrag?

"Back in in the DOS days there was a utility that rewrote the FAT
structure, insuring that the directories and their contents were in
an alphabetical order."


You might follow the ideas from the above link and post and see if you can find a program to rewrite the FAT or another to catalog your files.

Of course you could save your files to tape? Perhaps not!
 
Ive been playing with this for a while now. I've noticed a couple of strange things. If I select a number of files in windows explorer and copy and past then to a flash drive, the last file in the list always ends up the first file on the target drive. If I copy 12 files, for example, i end up with file 12 being first, followed by 1 through 11. All of the list except that last file seem to remain in order. But if I copy a larger number of files, say 30 or 40 files, file 20 through 40 end up at the top of the list and files 01 through 20 end up at the end of the list. I tried defragging the files and that doesnt seem to have any effect on the file order in the end.

ill check out the links though.. thanks

 
Hi Bookouri,
Why would you want to place the files in physical order? What if you copy more files to the drive? you'll have to do the whole sorting again.

To show the files in alpha order on a DOS prompt - use

DIR /ON or DIR /O-N (descending order)

do a dir /? to show all the switches for the DIR command.

 
well, what Im actually trying to do is load files up for an mp3 player that takes a flash drive. I can load up the flash drive with the files i want to play, but this player only plays the files in physical order. So if I want the files to play in order, they have to be stored in that order. Going through windows or DOS i can sort the display in all kinds of ways, but the mp3 player is only interested in the physical order of the files.

I have found that i can drag and drop my list of files to the flash drive. Go to dos and move them back to a temp locations. Move themm back to the flash drive and they are copied in the right order, with no gaps. So that solves my problem, but it is odd how windows does file copies.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top