Fixing Sort Order in Finder List Views
OS X users may find that filenames sort in the Finder in ways they do not expect. This is because OS X uses different sorting rules than do OS 9, Unix (including Terminal), and pre-WinXP Windows systems. Examples are digit strings and first/last markers.
Digits: A fundamental change in OS X is that strings of digits are ordered according to their numerical value (alphanumerically) rather than by each digit individually (lexicograhically). In the latter case (as in OS 9 or Terminal) a file called 11 comes before a file called 2, because 1 < 2. In OS X, file 2 comes before 11, because 2 < 11.
When a series of files has been named with digits so as to sort properly in OS 9 or Terminal, it may show up in quite a different order in OS X. If this is a problem, three possible fixes are:
a) Rename all the files to fit OS X conventions.
b) Operate on the files in Terminal or Classic.
c) Use a dimension other than name to sort the files in OS X. One possibility is the Comments field, where you can enter appropriate data and then have list view sorted according to that field.
<b>First/Last List Items: The standard way to get a file to appear at the top of the list in OS 9 is to put a space before its name, and to get it to appear at the bottom, a tilde or a bullet. In OS X both space and tilde/bullet put an item at the top of the list. To move a file name to the bottom, you can preface it with a Greek letter like mu (Option-m), omega (Option-z) or pi (Option-p).
For technical info on OS X sorting rules, see the Apple documentation:
http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/Concepts /SortingRules.html
and the Unicode sorting list (which seems to differ somewhat from what Apple is using):
http://www.unicode.org/Public/UCA/latest/allkeys.txt
In non-Unicode applications, sort order is also determined in System Preferences/International/Language/Customize Sorting.
If you want OS9/Classic to sort like OS X, you can try the program Natural Order:
http://www.naturalordersort.org/
If you want Terminal to sort like OS X, use ls -n when files begin with numbers, and sort -n (plus some additional info, see the man page) otherwise.
OS 9/Terminal sorting will work like OS X's if you make sure all digit strings have equal length, using zeros to pad the shorter numbers, e.g. 02, 11.
Digits: A fundamental change in OS X is that strings of digits are ordered according to their numerical value (alphanumerically) rather than by each digit individually (lexicograhically). In the latter case (as in OS 9 or Terminal) a file called 11 comes before a file called 2, because 1 < 2. In OS X, file 2 comes before 11, because 2 < 11.
When a series of files has been named with digits so as to sort properly in OS 9 or Terminal, it may show up in quite a different order in OS X. If this is a problem, three possible fixes are:
a) Rename all the files to fit OS X conventions.
b) Operate on the files in Terminal or Classic.
c) Use a dimension other than name to sort the files in OS X. One possibility is the Comments field, where you can enter appropriate data and then have list view sorted according to that field.
<b>First/Last List Items: The standard way to get a file to appear at the top of the list in OS 9 is to put a space before its name, and to get it to appear at the bottom, a tilde or a bullet. In OS X both space and tilde/bullet put an item at the top of the list. To move a file name to the bottom, you can preface it with a Greek letter like mu (Option-m), omega (Option-z) or pi (Option-p).
For technical info on OS X sorting rules, see the Apple documentation:
http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/Concepts /SortingRules.html
and the Unicode sorting list (which seems to differ somewhat from what Apple is using):
http://www.unicode.org/Public/UCA/latest/allkeys.txt
In non-Unicode applications, sort order is also determined in System Preferences/International/Language/Customize Sorting.
If you want OS9/Classic to sort like OS X, you can try the program Natural Order:
http://www.naturalordersort.org/
If you want Terminal to sort like OS X, use ls -n when files begin with numbers, and sort -n (plus some additional info, see the man page) otherwise.
OS 9/Terminal sorting will work like OS X's if you make sure all digit strings have equal length, using zeros to pad the shorter numbers, e.g. 02, 11.