Dired is, hands-down, the best way to browse your file system. Yeah, yeah, the command line is still faster if you know exactly what you’re looking for, but you’re simply trying to find something or trying to familiarize yourself with the tree, Dired is the way to go.

I’ll have to write a post some time that fully explores Dired, but for now, let me see if I can help you solve a pain point that I found.

Dired sports many nifty features, including the ability to rename or copy all the marked files in your current Dired buffer somewhere else with a simple key press.

If you were to do this from a traditional GUI explorer like Finder or Explorer, the easiest way is to launch 2 windows and then shift/control click through the files you want and drop them from the source to the target. Hopefully you don’t miss-click in the middle of a large selection process because none of those programs support undoing for re-selection.

In Dired, the process is much less error prone. You go to your source directory, mark each of the files you want with full undo support, either by manually scanning or by the various multi-mark commands (hello, regex!), and then press C or R and get dropped into the mini-buffer for reading in the target directory.

There’s no problem with that in terms of a single copy, but what if you want to do this copy over and over again, or what if you weren’t quite sure where the target directory is, or what if you want to be able to browse the target directory once you’re done the copy? All of that doesn’t lend itself very well to the method of reading target at the mini-buffer.

You’d be tempted of course to open the target in a Dired buffer using a separate window. The problem is that Dired doesn’t default to targeting the directory visited by the other Dired window.

Luckily, the developers of Dired were forward thinking enough that they thought you might want this sort of behavior, so they introduced a variable that you can set to automatically target a dired buffer in another window if that sort of thing exists for various operations, including C and R .

To set that up, type M-x customize-variable RET dired-dwim-target RET and toggle that puppy to on . Pop open two new dired buffers side-by-side and give your new-found automagic power a whirl.

Magic!

Now combine that with a nice window configuration stored in a register and you’ve got a pretty slick work flow.

(via StackOverflow)