Function: dired-do-delete

dired-do-delete is an interactive and byte-compiled function defined in dired.el.gz.

Signature

(dired-do-delete &optional ARG)

Documentation

Delete all marked (or next ARG) files.

dired-recursive-deletes controls whether deletion of non-empty directories is allowed.

When called from Lisp, if ARG is the symbol marked, delete only the marked files, or none if no files are marked.

View in manual

Probably introduced at or before Emacs version 26.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/dired.el.gz
(defun dired-do-delete (&optional arg)
  "Delete all marked (or next ARG) files.
`dired-recursive-deletes' controls whether deletion of
non-empty directories is allowed.

When called from Lisp, if ARG is the symbol `marked', delete
only the marked files, or none if no files are marked."
  ;; This is more consistent with the file marking feature than
  ;; dired-do-flagged-delete.
  (interactive "P" dired-mode)
  (let (markers)
    (dired-internal-do-deletions
     (nreverse
      ;; this may move point if ARG is an integer
      (dired-map-over-marks (cons (dired-get-filename)
                                  (let ((m (point-marker)))
                                    (push m markers)
                                    m))
                            arg))
     arg t)
    (dolist (m markers) (set-marker m nil)))
  (dired-post-do-command))