Solved

Explorer not sorting correctly

Posted on 2013-11-26
10
245 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
10 Comments
 
LVL 35

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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
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 35

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 35

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 35

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

One of the features I've come to appreciate about Windows 7 and Windows Server 2008 R2 is the ability to pin applications to the task bar. As useful a feature as I've found this, it does have some quirks.  For example, have you ever tried pinning an…
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
Suggested Courses

632 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