Enter Search Query:

Sorting Folders before files in Finder

I know that the mac works differently (so everyone keeps telling me!) but I’m sorry, that’s not a valid solution to a host of real annoyances. It’s true that I’m a Windows user and that I’ve got Windows habits (think delete key), but listing folders sorted separately from files in a window just seems something I ought to be able to do. Not in OSX though…unless you do this:
Credit for the trick in this article goes to Fahmie Salle who covered this on his blog back in ’08. Cheers!

Background: The Windows Explorer allows you to arrange files in a window a number of different ways. Most important to me is the folder detail view in explorer which sorts Folders alphabetically before regular files or as shown below:

Windows Explorer arrange by folder

OSX’s Finder on the other hand doesn’t do this. By default it sorts folders and files alphabetically because in Unix everything is a file. If you’ve always used Mac’s you probably don’t mind this, but if you’re used to seeing the folders in a directory at the top, this will be annoying.

OSX Finder Window sorted alphabetically

So here’s how to change the Finder in OSX so that folders will be listed at the top of the Finder window just like they are in Windows Explorer (see picture below).

OSX Finder sorted folders first

[step 1] Open Terminal.
[step 2] Edit the file InfoPlist.strings using vi as an editor.
NOTE: You’ll need to do this with elevated privileges using the sudo command and specify your password when prompted.

sudo vi /System/Library/CoreServices/Finder.app/Contents/Resources/English.lproj/InfoPlist.strings

[step 3] Find the line /* General kind strings */ and immediately below it change:

"Folder" = "Folder";

to

"Folder" = " Folder";

by adding a space in front of the word Folder on the left hand side of the equal sign. Later when we sort by kind (of file) it’ll sort folders first because of the space we’ve just added.

[step 4]  Save the file, quit, and restart Finder. I restarted the computer just to be safe.

[step 5] Open the finder and click settings->Arrange By->Kind.

arrange by kind
That’s it.

UPDATE: InfoPlist.strings is a Binary file in OS X Lion, so it must be changed to XML before editing and then changed back to binary. See my comment below for full instructions.

January 18, 2010

Related Posts

9 comments found

Comments for: Sorting Folders before files in Finder

  1. Pingback: Snow Leopard a few months later | David Vielmetter

  2. George

    Yes but you still forced to sort by Kind rather then name to get this hack to work. If you want to still have folders and files sorted alphabetically it will not help.

  3. adam

    does anybody have instructions to do this in OSX Lion? things seem to have changed in the new operating system…

    1. Post author: 
      David Vielmetter

      Instructions for sorting folders on top in Mac OS X Lion are similar to what is shown in this article, but the InfoPlist.strings file needs to be converted to xml for editing and back to binary after it is changed. Here’s how:

      Open Terminal.

      Type this command:

      cd /System/Library/CoreServices/Finder.app/Contents/Resources/English.lproj/

      Unfortunately, this file cannot be edited directly using text editor in Lion. Run this command to make it editable.

      sudo plutil -convert xml1 InfoPlist.strings

      Now the file should be editable and readable. Use your favorite text editor and open InfoPlist.strings. To use Vim, type:

      sudo vim InfoPlist.strings

      Inside you’ll find XML document. Go to the following lines:

      Folder
      Folder

      All you have to do is to add a space before the second Folder like this:

      Folder
      Folder

      Save the file. Convert the file to binary again using the following command.

      sudo plutil -convert binary1 InfoPlist.strings

      Restart Finder.

      killall Finder

      1. Dan

        Followed the above steps however, upon trying to edit the InfoPlist.strings file it is locked and won’t allow me to insert any spaces.

        I’m on OS X Lion.

        1. Post author: 
          David Vielmetter

          Yes, for Lion the instructions are different. See my other comment on the 7th. You’ll need to convert the file first, then modify it and then convert it back. If you’re not sure how to do this, I don’t suggest trying this as you could mess up your system.

          1. Dan

            I converted it successfully, however, it still did not allow editing of the file. I am doing this on an Administrator account…

            Thanks for the reply, I will try again later.

  4. jsherk

    This is great if you want to sort by KIND, but unfortunately does not work if you want sort by NAME (folder at the top by name, followed by all files sorted by name). No tricks for this yet on Lion?

    Thanks

    1. jrh_engineer

      The whole purpose here is to sort by name and separate folder from file, so this is worthless information – sorry.

Leave a Reply

Your email address will not be published. Required fields are marked *