How to have folders first before any file in finder (Mac) programmatically?

user11 picture user11 · Oct 30, 2014 · Viewed 20k times · Source

I am new to Mac OS. I want to have the folders first before any other file in finder through my cocoa app.

Can anyone suggest me a way of doing this like xtraFinder, PathFinder etc apps do?

I have gone through the followings links. One way is this:

http://hints.macworld.com/article.php?story=2011072120153685 http://mygeekdaddy.net/2013/10/24/change-mavericks-finder-app-sort-order/

And the other way I got is to drag the folders to first in the spotlight (in system preferences) then sort by kind.

But in both ways I don't know how to do this programmatically. Can anyone tell me step by step how to do this through my app?

Answer

Memariaan picture Memariaan · Jun 17, 2016

OS X Sierra finally has an option for this:

  • Open Finder
  • Go to Finder Menu -> Preferences
  • Go to "Advanced" tab
  • Check the "Keep folders on top when sorting by name"

Now, When you sort by name, can see folders at top of files (like as windows)

enter image description here

Good Luck ;)