38.19 Other Dired Features

An unusual Dired file-operation command is +
(dired-create-directory). This command reads a directory name,
and creates the directory if it does not already exist.

The w command (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.

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.