Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Explorer not sorting correctly

Posted on 2013-11-26
10
Medium Priority
?
247 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 560 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 240 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 560 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

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.

Question has a verified solution.

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

Article by: Lee
Windows 7 Ultimate and Enterprise (and 2008 R2) introduced a new feature you may not be aware of - Boot from VHD.   Boot from VHD (or what Microsoft refers to asNative Boot allows you to install Windows to a VHD (Virtual Hard Disk) file that is t…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

722 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