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?

1 Answer 1


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) Oct 16, 2018 at 6:29
  • 3
    This answer should be updated. The interactive command dired-copy-filename-as-kill is correct, but the advice should really be to use the universal argument directly rather than defining another command. Simply use C-u 0 w (@RecencyEffect's comment probably contains a typo).
    – ebpa
    Mar 15, 2019 at 16:41
  • 1
    Why use C-u 0 w when C-0 w is simpler?
    – Andy
    Jul 23, 2020 at 21:25
  • This answer (killing a file) doesn't fully answer the question (killing the currently selected files which could be multiple files.)
    – rdrg109
    May 12, 2021 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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