tags:

views:

147

answers:

3

Like when you drag a file on top of another one and change the order, like that.

+1  A: 

There is no way to do this (except maybe by hacking the directory structures on the disk using raw, sector-based APIs). The order of files on the disk is managed by the file system according to it's design and needs.

Michael Burr
I think he's talking in terms of Windows Explorer, how it retains the order and position of files in folders, on the Desktop etc.
dreamlax
Oh, I thought he meant something like so that FindNextFile() would return them in a particular order.
Michael Burr
Which can only be done on FAT, and not on NTFS which keeps directory entries in some flavor of tree structure and so the only order is the natural order of that tree. There used to be shareware tools that would sort the FAT directory entries, back in the day.
RBerteig
+3  A: 

I'm going to assume you're asking about how to rearrange the order in which files are displayed in a folder. I'm not exactly sure how to do it, but you'll want to use the various functions from the Windows shell to accomplish this. See the Shell Developer's Guide.

Adam Rosenfield
A: 

For what its worth, FAT directory entries are stored in the order in which they are added. NTFS actually indexes its directory entries, but I thought creation order still played some role in which order they're retrieved. Maybe not. Nearly every UI that does file listings does some type of sorting on display, though, usually alphabetical.

Bottom line-- if its not application-sorted and its not creation time, then there's nothing you can do.

tylerl