Function: dired

dired is an autoloaded, interactive and byte-compiled function defined in dired.el.gz.

Signature

(dired DIRNAME &optional SWITCHES)

Documentation

"Edit" directory DIRNAME--delete, rename, print, etc. some files in it.

Optional second argument SWITCHES specifies the options to be used when invoking insert-directory-program, usually ls, which produces the listing of the directory files and their attributes. Interactively, a prefix argument will cause the command to prompt for SWITCHES.

If DIRNAME is a string, Dired displays a list of files in DIRNAME (which may also have shell wildcards appended to select certain files).

If DIRNAME is a cons, its first element is taken as the directory name and the rest as an explicit list of files to make directory entries for. In this case, SWITCHES are applied to each of the files separately, and therefore switches that control the order of the files in the produced listing have no effect.

You can flag files for deletion with d (dired-flag-file-deletion) and then delete them by typing x (dired-do-flagged-delete). Type h (describe-mode) after entering Dired for more info.

If DIRNAME is already in a Dired buffer, that buffer is used without refresh.

View in manual

Probably introduced at or before Emacs version 1.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/dired.el.gz
;;;###autoload (define-key ctl-x-map "d" 'dired)
;;;###autoload
(defun dired (dirname &optional switches)
  "\"Edit\" directory DIRNAME--delete, rename, print, etc. some files in it.
Optional second argument SWITCHES specifies the options to be used
when invoking `insert-directory-program', usually `ls', which produces
the listing of the directory files and their attributes.
Interactively, a prefix argument will cause the command to prompt
for SWITCHES.

If DIRNAME is a string, Dired displays a list of files in DIRNAME (which
may also have shell wildcards appended to select certain files).

If DIRNAME is a cons, its first element is taken as the directory name
and the rest as an explicit list of files to make directory entries for.
In this case, SWITCHES are applied to each of the files separately, and
therefore switches that control the order of the files in the produced
listing have no effect.

\\<dired-mode-map>\
You can flag files for deletion with \\[dired-flag-file-deletion] and then
delete them by typing \\[dired-do-flagged-delete].
Type \\[describe-mode] after entering Dired for more info.

If DIRNAME is already in a Dired buffer, that buffer is used without refresh."
  ;; Cannot use (interactive "D") because of wildcards.
  (interactive (dired-read-dir-and-switches ""))
  (pop-to-buffer-same-window (dired-noselect dirname switches)))