17

When I want sort my files and folder in Finder (specially sort by name) they sort all item by name mixing folders and files together. I want a way that sorts (like Windows) first all folders by name then all other items by name. How can I do this?

1

8 Answers 8

9

There's no built in feature in the Finder to achieve that, but with the "plugin" TotalFinder you can get that. It's located under the "Tweaks" tab in the TotalFinder settings.

Edit: There was a screenshot here, but it was out of date. Look at Robsofts answer instead for an up-to-date screenshot!

4
  • I install it but I can't find my answer in this program. 1- my install version was newer than you and my Tweaks setting is different from yours. 2-it's in alpha version and expire then it's not good for me. 3-can you explain which part is related to my answer?
    – Am1rr3zA
    Commented Aug 19, 2010 at 18:38
  • I too have the latest version, but I have swedish as my system language so a screenshot from my computer would probably be even more confusing. But in the latest version it's still the setting that's located second to top in the Tweaks tab. And when the alpha expire there will probably be a new one released or the final version will be released, which will cost 15$ according to the developers website.
    – Nagon
    Commented Aug 19, 2010 at 22:20
  • Thanks for the link to TotalFinder, I'm finding it very useful already. I like the hidden files view - nice and grey rather than same colour as normal files, and the tabs are proving useful too.
    – robsoft
    Commented Aug 20, 2010 at 9:00
  • @Am1rr3zA - see my answer below for a picture of the current tweaks screen.
    – robsoft
    Commented Aug 20, 2010 at 9:04
5

XtraFinder is free plugin for Finder that allows you to sort folders before files, by selecting "Arrange folders on top" in the Preferences.

After installing and running it, you can tune folder sorting and many other aspects of Finder behavior.

1
  • 1
    this is a great solution, as it's not a hack, lets you continue using Finder, and it's free.
    – gabor
    Commented Jan 11, 2013 at 0:06
4

Here is a method that involves a plist setting, and no plugin, or third party app.

To summarize:

Show Package Contents of Finder.app (located in System/Library/CoreServices

Drill down to Contents > Resources > English.lproj. > InfoPlist.strings

Locate the string “Folder” = “Folder”;

Add a leading space before the second Folder as follows: “Folder” = “ Folder”;

Save InfoPlist.strings to the same location (backup elsewhere if desired)

Relaunch Finder (Ctrl+Option+Click)

Open new Finder window and sort files by Kind

3
  • Answers on Ask Different need to be more than just a link. It's okay to include a link, but please summarize or excerpt it in the answer. The idea is to make the answer stand alone.
    – Daniel
    Commented Aug 27, 2013 at 14:18
  • This solution doesn't seem to work for El-Capitan (Finder version 10.11). Is there an updated solution for this problem that doesn't involve any plugin or app?
    – Yaron Idan
    Commented Nov 14, 2015 at 13:20
  • As of El Capitan and later there is no need anymore to patch anything as the option to sort guides first has been added to the Finder settings. This solution is DEPRECATED.
    – ccpizza
    Commented Mar 4, 2020 at 7:50
4

As of OS X Yosemite (≥ 10.10), you can sort folders above files without any third-party apps.

Finder > Preferences -> Advanced tab -> Check "Keep folders on top: in windows when sorting by name" option.

3

Related to the Total Finder answer above (so please don't vote for this answer), here's a picture of the current TF tweaks page (you get to it from the Finder's Preferences screen). With these options I definitely get the folders at the top of the list.

You can also control this from the VIEW menu in Finder, once TF is installed.

Snapshot of current Total Finder tweaks screen

6
  • Tanx for your help, but why don't vote for your answer?
    – Am1rr3zA
    Commented Aug 20, 2010 at 9:44
  • @Am1rr3zA - TotalFinder was @Nagon's answer really - if you were allowed to paste images into comments then I would have just put this image below his/her answer. :-)
    – robsoft
    Commented Aug 20, 2010 at 11:19
  • ok I got it, but I vote you for your help, and accept and vote @nagon answer.
    – Am1rr3zA
    Commented Aug 20, 2010 at 11:40
  • @robsoft - If you don't mind I can put your image in my answer or at least point to your answer in some way? :)
    – Nagon
    Commented Aug 20, 2010 at 12:05
  • @Nagon - by all means, be my guest! :-)
    – robsoft
    Commented Aug 20, 2010 at 14:10
2

There is a Finder replacement called Path Finder that will do what you want. It's a bit more expensive but it does do a lot more than just a regular finder window.

2
  • +1 to sole your -1, because I thought your answer was related. I don't know who give you -1 and why!
    – Am1rr3zA
    Commented Aug 19, 2010 at 22:45
  • but it was not what I mean, path finder was a separate program and also didn't what I want!
    – Am1rr3zA
    Commented Aug 19, 2010 at 23:50
0

This is possible by having icons displayed as list (Cmd + 2) in Finder window. First click on the [Name] column header (this will sort all files by name), then click on [Kind] column header (this will sort items by kind, but keep the name sorting in groups).

2
  • This won't just sort out files, it will group by file type. Folders won't appear first and all file types will be separately sorted.
    – Josh K
    Commented Aug 19, 2010 at 17:30
  • it's a nice trick, but I want can do this in all form not just in cmd + 2 form. but tanx for your answer.
    – Am1rr3zA
    Commented Aug 19, 2010 at 18:09
0

Since I have found myself doing the Folder trick over and over again I ended up creating a bash script to automate renaming of the string in /System/Library/CoreServices/Finder.app/Contents/Resources/English.lproj/InfoPlist.strings.

  1. Save it as e.g. finder-folders-first.sh
  2. Make it executable: chmod +x finder-folders-first.sh
  3. Run with root permissions: sudo finder-folders-first.sh
#!/bin/bash
# Make folders sortable first in Finder

if [[ $EUID -ne 0 ]]; then
   echo "Script must be run as root! Aborting."
   exit 1
fi

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

cp -i InfoPlist.strings InfoPlist_ORIGINAL-`date +%b-%d-%Y_%H_%M_%S`.strings
plutil -convert xml1 InfoPlist.strings
sed 's|<string>Folder</string>|<string> Folder</string>|' InfoPlist.strings > InfoPlist_PATCHED.strings

diff InfoPlist.strings InfoPlist_PATCHED.strings

if [ $? -eq 0 ]; then
    echo File already patched! Exiting.
    exit -1
else
    echo Patching original file...
    plutil -convert binary1 InfoPlist_PATCHED.strings -o InfoPlist.strings

fi
echo Restarting Finder...
killall Finder
echo Done!

The last line restarts Finder. To do the same thing from the GUI press Alt+rightclick the Finder icon in the Dock and select Relaunch.

Now, in Finder click the Kind column once/twice to have the folders listed as first/last.

This works in Mavericks and Yosemite, but might not work in later versions.

1
  • Very nice and elegant solution! Sadly did not work on El Capitan though - InfoPlist_PATCHED.strings: file does not exist or is not readable or is not a regular file (Error Domain=NSCocoaErrorDomain Code=260 "The file “InfoPlist_PATCHED.strings” couldn’t be opened because there is no such file." UserInfo={NSFilePath=InfoPlist_PATCHED.strings, NSUnderlyingError=0x7f9c78d09bd0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}})
    – Mattias
    Commented Mar 3, 2020 at 23:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .