You can use
org-fstree (install from MELPA or from here). It seems to do exactly what you want, it even makes each heading be a link to the corresponding file or folder.
To use it, just put a line
in your org file and type
C-c C-c on it. This will create a copy of the directory tree mapped to nested org headlines.
A few caveats:
Every time you do
C-c C-c on the
#+BEGIN_FSTREE line, the whole set of headings is replaced, including any text you may have typed under the headings. So, if you do want to add your own notes to the tree, you probably want to delete the
#+BEGIN_FSTREE line after you have used it.
It adds a lot of trailing blanks to each header line. You can remove these with
I don't think it is strictly valid org syntax to nest headings inside a
#+BEGIN ... #+END structure.
Here is an example of what it produces:
* Trying out org-fstree
#+BEGIN_FSTREE: fstree-test-folder :relative-links t
** |D| [[file:fstree-test-folder/directory-A][directory-A]]
** |D| [[file:fstree-test-folder/directory-AA][directory-AA]]
*** | | [[file:fstree-test-folder/directory-AA/file-A][file-A]]
** |D| [[file:fstree-test-folder/directory-B][directory-B]]
*** | | [[file:fstree-test-folder/directory-B/file-B][file-B]]
** |D| [[file:fstree-test-folder/directory-C][directory-C]]
*** | | [[file:fstree-test-folder/directory-C/file-C][file-C]]
Of course, in emacs it looks nicer than that since the links only show the description part by default.