57

In Dired mode, I can m mark files and R to move them to a destination.

Some times the destination path is too long. With the destination open in a split window, is there a way to move files quicker?

When I see the two dired windows on the screen, I missed the drag-and-drop function in a GUI file manager.

79

From the documentation:

dired-dwim-target is a variable defined in `dired.el'. Its value is nil

Documentation: If non-nil, Dired tries to guess a default target directory. This means: if there is a Dired buffer displayed in the next window, use its current directory, instead of this Dired buffer's current directory.

The target is used in the prompt for file copy, rename etc.

Put this in your init file: (setq dired-dwim-target t). Then, go to dired, split your window, split-window-vertically & go to another dired directory. When you will press C to copy, the other dir in the split pane will be default destination.

1
  • 4
    Wow, that's great! Emacs is amazing! Thank you. – Nick Dec 21 '14 at 1:36
3

just for posterity:

there is also the handy dired-ranger package, which allows you to copy multiple sets of files to a clipboard, navigate to a target destination and copy or move them there. it also cooperates with the dired-dwim-target mentioned in the other answer.

it doesn't provide keybindings out of the box, you have to set them up yourself. you can do this with some thing like:

(eval-after-load "dired" '(progn
    (define-key dired-mode-map (kbd "C-x w") 'dired-ranger-copy)
    (define-key dired-mode-map (kbd "C-x x") 'dired-ranger-move)
    (define-key dired-mode-map (kbd "C-x y") 'dired-ranger-paste)
    ))

(use C-h c from dired to see what keybindings are undefined.)

it is available from melpa.

a brief description: http://pragmaticemacs.com/emacs/copy-and-paste-files-with-dired-ranger/.

0

% m is the command for dired-mark-files-regexp.

In addtion to @Nsukami _'s answer, if your target files shows a certain pattern, 'regex mark' might help boost the process.

1
  • Please say something in your answer about copying/moving, which is what the question asks. This doesn't seem to answer the question - this just tells us of a way to mark files (and there are many such ways). The OP clearly knows about marking, but wants to know about copying/moving the files that are marked. – Drew Nov 6 '20 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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