Take the 2-minute tour ×

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

share|improve this question
Can you clarify what you're asking? Like, sorting files in Windows Explorer? –  Anthony Apr 24 '09 at 2:51
what order are you referring to? –  warren Apr 24 '09 at 2:52

3 Answers 3

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.

share|improve this answer

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.

share|improve this answer
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 Apr 24 '09 at 4:02
Oh, I thought he meant something like so that FindNextFile() would return them in a particular order. –  Michael Burr Apr 24 '09 at 4:08
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 Apr 24 '09 at 8:07

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.

share|improve this answer

Your Answer

