I love dired, but sometimes (particularly when filming screencasts) I want to see the tree-structure of a directory and its children, a la the tree(1) command. Is there a tree-oriented directory browser for Emacs?
-
Pretty sure ecb can do this. – c-o-d Sep 28 '14 at 21:34
-
2@EdgarAroutiounian If that's the case, I recommend making an answer out of it :) – Trevoke Sep 29 '14 at 12:15
-
Although it isn't a *folding* tree filemanager, I would recommend [ranger.el](https://github.com/ralesi/ranger.el)! If you don't like the [Miller columns](https://en.wikipedia.org/wiki/Miller_columns) you can easily switch to [minimal ranger mode (deer)](https://github.com/ralesi/ranger.el#minimal-ranger-mode-deer). – upgrd Jun 17 '21 at 07:25
7 Answers
Additionally you can use dired-subtree from dired-hacks repo.
Here you have short demo and screenshot from my setup where I press i
to drill down folder and ;
to go back.:
(define-key dired-mode-map "i" 'dired-subtree-insert)
(define-key dired-mode-map ";" 'dired-subtree-remove)
PS
I'm also aware of direx which looks like that: :

- 2,395
- 1
- 15
- 15
-
I've tried dired-subtree but the tree structure wasn't as visually apparent as I was looking for. Direx looks perfect tho, I'm gonna go try it. – Avdi Sep 29 '14 at 22:40
-
1I'm this one because the suggestion of Direx looks ideal for my use case of putting a directory tree visualization front and center. That's not to discount @keelerm's excellent suggestions though. – Avdi Sep 29 '14 at 22:49
-
You can get equivalent functionality using one key binding: (define-key dired-mode-map "i" 'dired-subtree-toggle). I like to map it to "C-c i" though since dired also does insert subdirectory using "i". – Joe Oct 06 '19 at 20:47
There are a couple of options for this.
You can check out dirtree, which is based on dired.
There is also an emacs port of vim's NERDTree called neotree.
Both are excellent packages, though I tend to favor neotree as it has convenient bindings to let me create and delete files and directories. I do not believe dirtree has this support, though I could be wrong. It has been a while since I last used it.

- 381
- 2
- 4
-
Thanks, while direx looks to be ideal for my immediate need, you've reminded me that I need to spend some time with neotree. – Avdi Sep 29 '14 at 22:50
Have you ever tried Emacs' M-x speedbar
? :-) before installing some new package I'd try an inbuilt solution...
Update 2020-01-10
Actually I'm using now dired-sidebar which is available via Melpa.

- 1,836
- 14
- 25
You can invoke dired
with an argument, ie. C-u C-x d and after prompting for the directory it will also let you modify the switches passed to ls
. Add R
and dired
will recursively list all sub-directories, each in it's own section.
If you only want to see the contents of some sub-directories, press i when the point is on a directory name.
You can also use the find-dired
command, with or without switches. Instead of showing sub-directories in their own section it prints the full path of each file. You can toggle showing file details with ( so that the long paths fit horizontally on screen.
These are all built-in.

- 75,699
- 9
- 109
- 225

- 111
- 1
- 2
There is also ztree. I use it when I need to take a look at directory structure, although usually I use vanilla Dired for all other things.

- 4,893
- 1
- 24
- 53
Take a look at sidebar.el.
As the repo said, it is is a customizable file explorer with git integration, but not only that. You can also get the list of buffers and your maildirs with mu4e.

- 634
- 7
- 16
-
Is this an answer or a question (two questions)? It is pretty-much a link-only answer, if it is an answer. As such, it risks being deleted. See https://emacs.stackexchange.com/help/how-to-ask. – Drew Nov 18 '17 at 00:13
-
1@Drew, fwiw I think this is just a language/interpretation issue. Treemacs is an absolutely acceptable suggestion to the OP's question. – EdwardG Jan 06 '18 at 04:08