Previous: Image-Dired, Up: Dired

30.19 Other Dired Features

The command + (dired-create-directory) reads a directory name, and creates that directory. It signals an error if the directory already exists.

The command M-s a C-s (dired-do-isearch) begins a “multi-file” incremental search on the marked files. If a search fails at the end of a file, typing C-s advances to the next marked file and repeats the search; at the end of the last marked file, the search wraps around to the first marked file. The command M-s a M-C-s (dired-do-isearch-regexp) does the same with a regular expression search. See Repeat Isearch, for information about search repetition.

The command w (dired-copy-filename-as-kill) puts the names of the marked (or next n) files into the kill ring, as if you had killed them with C-w. The names are separated by a space.

With a zero prefix argument, this uses the absolute file name of each marked file. With just C-u as the prefix argument, it uses file names relative to the Dired buffer's default directory. (This can still contain slashes if in a subdirectory.) As a special case, if point is on a directory headerline, w gives you the absolute name of that directory. Any prefix argument or marked files are ignored in this case.

The main purpose of this command is so that you can yank the file names into arguments for other Emacs commands. It also displays what it added to the kill ring, so you can use it to display the list of currently marked files in the echo area.

If the directory you are visiting is under version control (see Version Control), then the normal VC diff and log commands will operate on the selected files.

The command M-x dired-compare-directories is used to compare the current Dired buffer with another directory. It marks all the files that are “different” between the two directories. It puts these marks in all Dired buffers where these files are listed, which of course includes the current buffer.

The default comparison method (used if you type <RET> at the prompt) is to compare just the file names—each file name that does not appear in the other directory is “different”. You can specify more stringent comparisons by entering a Lisp expression, which can refer to the variables size1 and size2, the respective file sizes; mtime1 and mtime2, the last modification times in seconds, as floating point numbers; and fa1 and fa2, the respective file attribute lists (as returned by the function file-attributes). This expression is evaluated for each pair of like-named files, and if the expression's value is non-nil, those files are considered “different”.

For instance, the sequence M-x dired-compare-directories <RET> (> mtime1 mtime2) <RET> marks files newer in this directory than in the other, and marks files older in the other directory than in this one. It also marks files with no counterpart, in both directories, as always.

On the X Window System, Emacs supports the “drag and drop” protocol. You can drag a file object from another program, and drop it onto a Dired buffer; this either moves, copies, or creates a link to the file in that directory. Precisely which action is taken is determined by the originating program. Dragging files out of a Dired buffer is currently not supported.