Solved

Explorer not sorting correctly

Posted on 2013-11-26
10
237 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
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.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I recently purchased an HP EliteBook 2540p notebook/laptop. It has two video ports on it – VGA and DisplayPort. HP offers an optional docking station for the 2540p that also has both a VGA port and a DisplayPort. There are numerous online reports do…
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 …
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 give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

760 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