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.

2
  • 1
    Just an FYI - this is under developmend and will be released either in ELPA as a new package (dired-du) or as part of dired itself.
    – Alex
    May 31, 2017 at 7:01
  • I saw this package land in ELPA just yesterday. Jun 1, 2017 at 12:31

2 Answers 2

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.

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)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.