Solved

Explorer not sorting correctly

Posted on 2013-11-26
10
242 Views
Last Modified: 2013-11-26
Windows 7 Explorer is not sorting files correctly.  I have sorted them by Name ascending and also done a DIR command,  Sort order is different.  Any ideas?
FileSort.png
0
Comment
Question by:rogerfg7
  • 4
  • 4
  • 2
10 Comments
 
LVL 34

Assisted Solution

by:Dan Craciun
Dan Craciun earned 140 total points
ID: 39678039
Because the first chars are numbers, it sorts correctly:
002
17
380
961
2597
3943
0
 
LVL 14

Assisted Solution

by:comfortjeanius
comfortjeanius earned 60 total points
ID: 39678159
Windows sort numbers before alphabets; plus most record management systems perform this action as well.
0
 

Author Comment

by:rogerfg7
ID: 39678173
Many thanks for your observation, I never thought of that.

But I want it to sort alphabetically (as per DOS) not numerically. MS too clever sometimes.

Does it also sort Month names in chronological order?
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 14

Expert Comment

by:comfortjeanius
ID: 39678219
You can use the "Date Modified" or you the advance filter by clicking the drop down arrow.Search Features
0
 
LVL 34

Expert Comment

by:Dan Craciun
ID: 39678241
No, it won't put March before December.
0
 

Author Comment

by:rogerfg7
ID: 39678264
What I need to do now is modify my VS 2005 code in my application to sort them in the same order as Windows

I am using

file1.FilePath.CompareTo(file2.FilePath) in the IComparer Compare method.

Are there any inbuilt compare routines that act the same as Windows sort or do I write my own?

I guess this might be another post as it is now extending the topic.
0
 
LVL 34

Accepted Solution

by:
Dan Craciun earned 140 total points
ID: 39678282
Use this function: StrCmpLogicalW(file1.Path, file2.Path)
http://msdn.microsoft.com/en-us/library/bb759947.aspx
0
 

Author Comment

by:rogerfg7
ID: 39678289
Just done an Internet search on this very topic and it seems the answer is 'write your own'.

Many thanks guys.  It's always the obvious that you miss!!
0
 
LVL 34

Expert Comment

by:Dan Craciun
ID: 39678314
Why write your own???
StrCmpLogicalW is used by Windows Explorer to sort files. You can't get closer than that :)
0
 

Author Comment

by:rogerfg7
ID: 39678526
There seems to be no equivalent available in .Net managed code

stackoverflow.com/questions/8793856/net-equivalent-of-strcmplogicalw
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question