Emacs: Dired Sort File by Time, Size 🚀
Here's a emacs command that lets you sort dired file listing by any date time, size, name.
put this in your Emacs Init File:
(defun xah-dired-sort () "Sort dired dir listing in different ways. Prompt for a choice. Works in linux, MacOS, Microsoft Windows. URL `http://xahlee.info/emacs/emacs/dired_sort.html' Created: 2018-12-23 Version: 2025-01-05" (interactive) (let ((xmenu '(("date" . "-Al -t") ("size" . "-Al -S") ("name" . "-Al ") ("dir" . "-Al --group-directories-first"))) xsortBy) (setq xsortBy (completing-read "Sort by (default date):" xmenu nil t nil nil (caar xmenu))) (dired-sort-other (cdr (assoc xsortBy xmenu)))))