emacs dired reverse date order
Asked Answered
T

2

9

Is there a means to reverse the date sort order in dired?

Toggling to Dired by date mode by hitting 's' orders newest to oldest, top to bottom. I would like to reverse this so I see oldest to newest top to bottom

Toothlike answered 16/6, 2015 at 10:29 Comment(0)
C
12

Use a prefix argument to dired-sort-toggle-or-edit: C-u s. This lets you manually specify the flags you wish to pass to ls:

Toggle sorting by date, and refresh the Dired buffer.
With a prefix argument, edit the current listing switches instead.

Then make sure to include both -t (to sort by modification time) and -r (to reverse the sort), e.g.

-altr RET
Cornaceous answered 16/6, 2015 at 11:8 Comment(0)
S
1

You do not need to manually change the ls switches for Dired, even via C-u s.

Just use command dired-sort-menu-toggle-reverse from library Dired Sort Menu (dired-sort-menu.el). dired-sort-menu.el binds it to r in Dired, by default.

If you also use library dired-sort-menu+.el and Dired+ then the command is rebound to | instead (r is for diredp-rename-this file).

Slogan answered 16/6, 2015 at 15:33 Comment(2)
do you mean type M-x dired-sort-menu-toggle-reverse? I don't seem to have that available (i'm using 24.3.1). Only similar thing that I have is dired-sort-toggle-or-editToothlike
I mean (1) download dired-sort-menu.el, put it in your load-path, and require it. It binds r to dired-sort-menu-toggle-reverse. If you use Dired+ then you might want to bind it to a different key. If you also download library dired-sort-menu+.el then you get some enhancements to dired-sort-menu.el, and it automatically binds the command to | instead of r, since r is bound to something else by Dired+.Slogan

© 2022 - 2024 — McMap. All rights reserved.