Mac – How to copy files from a remote server to a local folder in emacs using dired/tramp

emacstramp

When I use tramp to open a remote directory (say C-x C-f /ssh:user@example:/somedirectory), it opens up a dired buffer for that remote directory. The problem is that I want to copy directories and or files from the remote server to my local machine. I've tried a few syntaxes like marking all the directory or files, pressing 'C', and specifying local:/somelocaldir or just /somelocaldir, but at best the files get copied onto a file somewhere on the remote server.

Is there a way to copy files from a remote (tramp) dired buffer to a local dir? I've only been using emacs 6 months, so if there's a completely different approach that is better and still lets me use emacs (preferably w/ dired), that would be great.

Just to clarify, I'm not interested in viewing, editing, listing, etc. remote files. I just want to copy files from a remote server to my local machine, with the same effect you'd get if you'd used scp or scp -r. I'm just hoping I can do this w/o having to drop out of emacs or even use the eshell (but I'll probably just do that until I get an answer here).

Best Answer

Here's one way. This works for me on emacs 23.

In dired mode, navigate to the file you'd like to copy.

  1. Press M to mark the file.
  2. Do an M-x dired-do-copy and you'll be prompted for a location in the mini-buffer.
  3. Edit the location to the local location you'd like to copy to and smack enter.

Done.

Related Question