Search code examples
sortingemacsdired

In Emacs 24.3.1 on Windows 7, how can I group directories first in dired?


I have recently started to use dired in earnest, having belatedly checked out the advice to use C-x C-j given in one of the answers to this question. The 'jump' function is as useful as promised and has led me to investigate dired seriously. One snag is that I cannot group directories above files in dired buffers. I have tried putting the following in my .emacs.d file but it has no effect, presumably because I am running on Windows.

(setq dired-listing-switches "--group-directories-first -alh")

How can I achieve grouped directories above files in dired buffers in Windows 7?

[EDIT] as per the answer below, dired-sort-menu does seem to work - see following screenshot.

dired-sort-menu screenshot


Solution

  • DiredSortMenu may help you with that. It has an option for sorting with directories first.

    If you dont't use a package like that, you may find the "ls" options supported in Windows by doing C-h f RET insert-directory (as you guessed, "--group-directories-first" is not supported).