windows 10, emacs 25.1, dired+

Suppose in folder I select 3 files. Something like this:


Now I want 2 options:

  1. Copy to kill-ring the selected files names. So the result must be:




  2. Copy to kill-ring the full path of selected files names.

So the result must be:




Is it possible?


You can copy file names by pressing w. It calls the function dired-copy-filename-as-kill:

(dired-copy-filename-as-kill &optional ARG)

Copy names of marked (or next ARG) files into the kill ring. The names are separated by a space. With a zero prefix arg, use the absolute file name of each marked file.

Hence, in order to copy the full path of marked files to the kill ring, I've added the following piece of code:

(defun tl/dired-copy-path-at-point ()
    (dired-copy-filename-as-kill 0))

(define-key dired-mode-map (kbd "W") 'tl/dired-copy-path-at-point)
  • Also a universal argument works: C-u 0 M-x w (I just learned) – RecencyEffect Oct 16 '18 at 6:29

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.