Change the position of folders in sort by Kind views

Sep 24, '04 10:45:00AM

Contributed by: Anonymous

It's just a little thing, but it bothers me that when sorted by Kind in List view, folders are clumped under "F in the middle of the file list. Sure, I understand that the computer sees a folder as just another file, but to my mind, a folder is a container for files, and as such, is distinct from other file types (at least in the context of situations in which I want to sort by Kind in the first place). For this reason, I would prefer folders to sort either to the beginning or the end of a list sorted by Kind.

For most applications, the string used to define the "Kind" of documents it "owns" is stored in that application's Info.plist. However, in the case of the system, the location is a little harder to find. It turns out that it is in the Localized.strings file of a given language's .lproj folder, within the directory: /System -> Library -> Frameworks -> ApplicationServices.framework -> Versions -> A -> Frameworks -> LaunchServices.framework -> Versions -> A -> Resources. Within the Localized.strings file, the addition of a single space eliminated my sorting order woes, ie. changing:

"Folder" = "Folder"; to "Folder" = " Folder";

A full restart was required for the changes to take effect. Other types included in the file are: "Alias," "Application," "Classic Application," "Document," "Package," "Trash," "Unix Executable File," "Volume," and "%@ Document" which seems to refer to files "owned" by Classic apps.

Other than breaking AppleScripts that are dependent on "Kind ... is folder" statements, I haven't noticed any ill effects (so far...). Since this hint only edits the localized version of the string, my (unqualified) opinion is that it should be safe. Any reasonable application should be aware that OS X can be running in a number of languages, so it shouldn't be dependent on the localized name of a file type, but rather the "archetype" name -- i.e. the string on the left side of the equation. For example, the Finder's "Find..." command still works. However, since a system file is involved, proceed at your own risk. Make a backup first, be careful making changes, and for security reasons, make sure the ownership and permissions haven't been altered. Also keep in mind that the changes may be wiped out by future system updates.

[robg adds: This change worked as described. To edit the file, you'll need to have admin powers. I changed the ownership on the enclosing Resources folder to my admin user, edited the file with TextEdit, told it to Overwrite when saving, and then switched the ownership of Resources back to the system. After a restart, folders did indeed float right to the top of the list. If you want them to go to the end of the list, you'd have to use one of the characters discussed in this hint.]

Comments (11)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20040920153725600