Emacs Dired: copying to the current folder
Solution 1:
M-x copy-file RET will prompt for the source file, then default to the current directory. You could bind that to a key.
Or, if that's not good enough, let me know and I'll write the command and post it.
Eh, I had some time, so here's the command:
(defun dired-copy-file-here (file)
(interactive "fCopy file: ")
(copy-file file default-directory))
(eval-after-load "dired"
'(define-key dired-mode-map "\M-c" 'dired-copy-file-here))
Solution 2:
As Aurélien mentions, the only advantage you gain from being in a specific Dired buffer seems to be .
means "here", so going for a shell cp
is almost all you can do.
The other advantage that comes to my mind is, if you have another visible dired buffer (C-x2..), when you move/copy/link from the buffer you're in (from which you select all your files, therefore), emacs gives you some default targets as destinations, which are accessible with the <down>
arrow when you're prompted in the minibuffer.
Say you have 2 dired buffers open, ~/here/
and ~/elsewhere/someplace/
, then selecting a few files in ~/here/
, pressing C in that buffer, then ↓ should give you the default option to copy stuff to ~/elsewhere/someplace/
. Same for single files, you get the default directory, and the default directory+filename (e.g. ~/here/some long annoying filename you'd like to edit.any
→ ~/elsewhere/someplace/some long annoying filename you'd like to edit.any
).
Just press ↓ again for more defaults.