Files sorting wrong on OSX vs. XP

Joined
Mar 17, 2008
Messages
2
Reaction score
0
Points
1
I've converted all the computers in my house to mac at this point, but when I switched my main photography system over I found a problem where the files are sorting differently. I numbered my shoots in hex because the old way of decimal was stretching out my shoot numbers too far. Now, my folders sort out of order because 0AB sorts before 07D. I thought 7 came before A, and with a registry tweak, so did windows XP. How do I make OSX sort things by numbers first, then letters, so hex (base-16) folders sort properly?
 
Joined
Jan 29, 2008
Messages
101
Reaction score
6
Points
18
I've converted all the computers in my house to mac at this point, but when I switched my main photography system over I found a problem where the files are sorting differently. I numbered my shoots in hex because the old way of decimal was stretching out my shoot numbers too far. Now, my folders sort out of order because 0AB sorts before 07D. I thought 7 came before A, and with a registry tweak, so did windows XP. How do I make OSX sort things by numbers first, then letters, so hex (base-16) folders sort properly?

You don't say which application you are using, so I assume you are referring to the sort order in Finder. I don't think there is a way to do what you want in Finder. I would look at iPhoto, Aperture, Lightroom, or some other photo management app.
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
Interesting. I created some files to test this. The Finder seems to display the list in the wrong order. It clearly has its own way, which is fine, but I can't figure it out. For instance if A7 comes after 10, why does 0AB come before 01, 07 or 07D?

These are the files listed in the Terminal properly:

aaa-01.txt
aaa-07.txt
aaa-07D.txt
aaa-0AB.txt
aaa-1.txt
aaa-10.txt
aaa-A7.txt

In the Finder they list as this:

aaa-0AB.txt
aaa-01.txt
aaa-1.txt
aaa-07.txt
aaa-07D.txt
aaa-10.txt
aaa-A7.txt

You might be interested in this MacOSXHints tip.
 
OP
C
Joined
Mar 17, 2008
Messages
2
Reaction score
0
Points
1
Thanks for the interest...

Yes, I am trying to do this organization within finder. I'm using Microsoft Expression Media to tag and search my photos, all 31,000 or so of them. I switched from windows running iView Media Pro, and MS bought out iView so here I am.

IVMP and therefore Expression Media put the folders in the correct order. WinXP needed a registry tweak to turn off its intelligent handling of numbers/letters on filename sorting.

I'm receptive to switching to another photo management app at this point, and have heard good things about iPhoto, but need something that can read the jpeg previews built into DNGs made by Photoshop's camera raw. IVMP was the only windows app that would do that... I hadn't looked into mac since I wasn't using it. Also, features like people finder, place finder, and a great search tool made it my choice. My organizational system is was divided into 4gb folders per DVD backup, but I'm moving now towards DL DVDs at ~9gb.

All the metadata should be distributed, so I should be able to switch painlessly.
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
Perhaps you should try the free 30-day downloads of Apple's Aperture and Adobe's Lightroom.
 
Joined
Oct 3, 2014
Messages
6
Reaction score
0
Points
1
Interesting. I created some files to test this. The Finder seems to display the list in the wrong order. It clearly has its own way, which is fine, but I can't figure it out. For instance if A7 comes after 10, why does 0AB come before 01, 07 or 07D?

These are the files listed in the Terminal properly:

aaa-01.txt
aaa-07.txt
aaa-07D.txt
aaa-0AB.txt
aaa-1.txt
aaa-10.txt
aaa-A7.txt

In the Finder they list as this:

aaa-0AB.txt
aaa-01.txt
aaa-1.txt
aaa-07.txt
aaa-07D.txt
aaa-10.txt
aaa-A7.txt

You might be interested in this MacOSXHints tip.

Can't follow the "hint" — authorization required. But I figured it out.

Terminal is running in UNIX, which Mac OS X runs on top of. There you will see UNIX sort order, which apparently recognizes hexadecimal digits, not hexadecimal values: "aaa-0AB.txt" is sorted before "aaa-1.txt" even though hex AB is a larger number than hex 1.... CORRECTION: rethinking, rather than a hexadecimal sort, it could be just a character by character alphanumeric sort: '0' before '9' before 'a' before 'z', with some convention about which alphabetic case comes first.

Mac OS X has its own conventions:
Decimal numbers are sorted numerically, without regard for leading zeros except for tie breaking.
Alphabetic strings are sorted alphabetically, without regard for case except for tie breaking.
Numbers are sorted before alphabetic strings.
Mixed filenames are parsed into consecutive numeric and alphabetic strings and then sorted according to the first string, then the next string, and so on.

For example, any filename beginning with '1a' comes before one beginning with '02a', which in turn comes before any filename beginning with either 'a' or 'A'.

Note added in editing: running OS X 10.9.5 Mavericks. The sort algorithms haven't changed in lo these many years.
 
Last edited:
Joined
Jul 30, 2009
Messages
7,298
Reaction score
302
Points
83
Location
Wisconsin
Your Mac's Specs
Mac Mini (Late 2014) 2.6GHz Intel Core i5 Memory: 8GB 1600MHz DDR3
Thread is nearly 6-1/2 years old!
 
Joined
Oct 3, 2014
Messages
6
Reaction score
0
Points
1
Thread is nearly 6-1/2 years old!

Thanks for stating the obvious. I know it's over 6 years old. So what? It's still an issue, because, as I said, which you may not have noticed, the sort algorithms haven't changed since then.

I noticed the problem while looking for a particular file in an Audacity data folder (which has a lot of files with hexadecimal file names). I Googled for a solution, and couldn't find one, but I found a thread where people were looking for an explanation. So I posted an explanation where people might find if they Googled the way I did.

Do you have a better idea? I mean, should I have started a new thread with a question and my own answer to it? Tell me something I don't know.
 

chscag

Well-known member
Staff member
Admin
Joined
Jan 23, 2008
Messages
65,248
Reaction score
1,833
Points
113
Location
Keller, Texas
Your Mac's Specs
2017 27" iMac, 10.5" iPad Pro, iPhone 8, iPhone 11, iPhone 12 Mini, Numerous iPods, Monterey
Do you have a better idea? I mean, should I have started a new thread with a question and my own answer to it? Tell me something I don't know.

No, that's not necessary. However, so we know that you realize you're responding to an old thread and adding additional info, it would help to preface your reply with something like:

"I know this a 6 year old thread but I thought I would add to it with this information" Anyway, you get the idea. And thanks for taking the time to add to this thread. We appreciate it. :)
 
Joined
Jul 30, 2009
Messages
7,298
Reaction score
302
Points
83
Location
Wisconsin
Your Mac's Specs
Mac Mini (Late 2014) 2.6GHz Intel Core i5 Memory: 8GB 1600MHz DDR3
Thanks for stating the obvious. I know it's over 6 years old. So what?

It's not always obvious to everyone. I frequently see people responding to one of the old posts as if this person is currently encountering a problem. When they find out that there's a good chance that person will never see their new post, they sometimes express embarrassment at not having noticed the old date on all but the new post that revived an old thread. I was posting for the benefit of the community, not to tell you something I had no idea if you already knew or not, because, as you surmised, I did not catch the "lo these many years" phrase at the end. (See the Admin's post.) You've probably heard the term "necro-thread". My post was a necro-thread alert. Have I told you some things you didn't think about or know about?
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top