Solved

Explorer not sorting correctly

Posted on 2013-11-26
10
238 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
 
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

First some basics on Windows 7 Backup.  It has 2 components one is a file based backup which is stored in .zip files each zip is split at around 200 Megabytes and there is the Image Backup which is as the name implies a total image of the partition …
By default the complete memory dump option is disabled in windows . If we want to enable the complete memory dump for a diagnostic purpose, we have a solution for it. here we are using the registry method to enable this.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.

864 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now