Skip to main content
2 of 6
added 72 characters in body
Drew
  • 79.1k
  • 10
  • 123
  • 257

C-h f dired tells you the answer. Just pass to dired, as the DIRNAME argument, a list that has as its car the Dired buffer name you want (any string) and as cdr the list of file names you want listed in the buffer. Generally, you want to use absolute file names.

If you use library Dired+ (dired+.el) then you can even do this interactively: just use a non-negative prefix argument with command dired. You are then prompted repeatedly for the directories and file names you want listed. You can use file-name wildcards (i.e., * for globbing), to include the matching files and directories. Use C-g to end inputting.

In other words, instead of listing a single directory, the Dired buffer can list any number of directories and file names, which can even belong to different directory trees.

(A non-positive prefix arg prompts you for the ls listing switches. So a zero prefix arg prompts you for both - first the ls switches and then the files/dirs to list.)

Drew
  • 79.1k
  • 10
  • 123
  • 257