15

I'd like to display the recursive size (the value that would be reported by du) of folder contents in-line in the dired buffer as an additional column or in place of the directory file size. Is this already possible with dired/dired+ or a related package?

I've done some digging and found some discussion of this sort of functionality, but nothing that integrates that size information back into the graphical interface of dired.

ebpa
  • 7,319
  • 26
  • 53

2 Answers2

8

Indeed, Alex is right.

If your Emacs version is >=24.4, then you can try `dired-du' library. It's available from the ELPA repository.

Once you've installed this lib: If your current buffer is in Dired mode, then you can do:

C-x M-r

that toggles the `dired-du-mode' and displays the recursive size of the directories 'in place' in the Dired buffer. If you visit a new Dired buffer, then it will show recursive buffers as well, until you toggle off the mode.

Another tip:

C-x C-h

This toggles the size format. There are 3 formats:

  1. Default one from `ls' command.

  2. Human readable format.

  3. Numeric format with thousands comma separator.

You can customize the option `dired-du-size-format' to make your size formar choice persistent.

ebpa
  • 7,319
  • 26
  • 53
Tino
  • 420
  • 5
  • 9
2

If you find dired-du slow, you can instruct it to use duc:

;; Index the filesystem regularly
(when (executable-find "duc")
 (run-with-timer 0 3600 
  (defun my-index-duc ()
   (start-process "duc" nil "duc" "index" "/home"))))

;; Let dired show true directory sizes
(require 'dired-du)
(when (and (executable-find "duc")
           (not (string-match-p "Error" (shell-command-to-string "duc info"))))
  (setq dired-du-used-space-program '("duc" "ls -bD"))
  (add-hook 'dired-mode-hook #'dired-du-mode)))
meedstrom
  • 131
  • 3