Copying files between dired buffers

There is a couple of packages for emacs that really have application character. Like for example:


And there are propably some more. Me personally – I did not adopt well to the „App in Emacs“ approach as I use none of the mentioned packages. It’s not a categorical decision, I just did not get used to it. My writings in Emacs Lisp have a much lesser extend: Recently I had need to copy files from one directory to the other and I just love to have this done with two directories showing up side by side as in well known „file commanders“. That said Emacs Lisp comes to the rescue!

(defun mp-dired-2pane-copy-over ()
    (when (eq 2 (length (window-list)))
      (let ((other-directory nil)
            (file-to-copy (dired-get-filename)))
          (other-window 1)
          (setq other-directory (dired-current-directory))
          (other-window 1)
          (copy-file file-to-copy other-directory)
          (other-window 1)
          (other-window 1)))))

5 Gedanken zu „Copying files between dired buffers“

  1. in info (emacs) Operating on Files the variable ‚dired-dwim-target‘ is documented as follows:

    Commands which ask for a destination directory, such as those which copy and rename files or create links for them, try to guess the default target directory for the operation. Normally, they suggest the Dired buffer’s default directory, but if the variable ‘dired-dwim-target’ is non-‘nil’, and if there is another Dired buffer displayed in the next window, that other buffer’s directory is suggested instead.

  2. I really like dired-ranger. You add files to a „clipboard“ (dired-ranger-copy), switch to another dired buffer, and then either copy (dired-ranger-paste) or move (dired-ranger-move). Pretty much just like Windows Explorer-type file managers. You can add to the clipboard from any number of dired buffers, and you can do it without splitting the frame.

  3. I also like Dired-Ranget, it extends dired functionality and doesn’t get in the way and works well with Tramp. The desktop file manager I use is Krusader, which I still use for big transfers if the transfers take too muchtme. If Dired Ranger could copy async in the background I would use it exclusively.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.