Function: dired-do-copy

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

Signature

(dired-do-copy &optional ARG)

Documentation

Copy all marked (or next ARG) files, or copy the current file.

ARG has to be numeric for above functionality. See dired-get-marked-files for more details.

When operating on just the current file, prompt for the new name.

When operating on multiple or marked files, prompt for a target directory, and make the new copies in that directory, with the same names as the original files. The initial suggestion for the target directory is the Dired buffer's current directory (or, if dired-dwim-target is non-nil, the current directory of a neighboring Dired window).

If dired-copy-preserve-time is non-nil, this command preserves the modification time of each old file in the copy, similar to the "-p" option for the "cp" shell command.

This command copies symbolic links by creating new ones, similar to the "-d" option for the "cp" shell command. But if dired-copy-dereference is non-nil, the symbolic links are dereferenced and then copied, similar to the "-L" option for the "cp" shell command. If ARG is a cons with element 4 (C-u (universal-argument)), the inverted value of dired-copy-dereference will be used.

Also see dired-do-revert-buffer.

Probably introduced at or before Emacs version 27.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/dired-aux.el.gz
;;;###autoload
(defun dired-do-copy (&optional arg)
  "Copy all marked (or next ARG) files, or copy the current file.
ARG has to be numeric for above functionality.  See
`dired-get-marked-files' for more details.

When operating on just the current file, prompt for the new name.

When operating on multiple or marked files, prompt for a target
directory, and make the new copies in that directory, with the
same names as the original files.  The initial suggestion for the
target directory is the Dired buffer's current directory (or, if
`dired-dwim-target' is non-nil, the current directory of a
neighboring Dired window).

If `dired-copy-preserve-time' is non-nil, this command preserves
the modification time of each old file in the copy, similar to
the \"-p\" option for the \"cp\" shell command.

This command copies symbolic links by creating new ones,
similar to the \"-d\" option for the \"cp\" shell command.
But if `dired-copy-dereference' is non-nil, the symbolic
links are dereferenced and then copied, similar to the \"-L\"
option for the \"cp\" shell command.  If ARG is a cons with
element 4 (`\\[universal-argument]'), the inverted value of
`dired-copy-dereference' will be used.

Also see `dired-do-revert-buffer'."
  (interactive "P")
  (let ((dired-recursive-copies dired-recursive-copies)
        (dired-copy-dereference (if (equal arg '(4))
                                    (not dired-copy-dereference)
                                  dired-copy-dereference)))
    (dired-do-create-files 'copy #'dired-copy-file
			   "Copy"
			   arg dired-keep-marker-copy
			   nil dired-copy-how-to-fn)))