1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
3 @c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
4 @c See file emacs.texi for copying conditions.
5 @node Dired, Calendar/Diary, Rmail, Top
6 @chapter Dired, the Directory Editor
7 @c This node is referenced in the tutorial. When renaming or deleting
8 @c it, the tutorial needs to be adjusted.
10 @cindex file management
12 Dired makes an Emacs buffer containing a listing of a directory, and
13 optionally some of its subdirectories as well. You can use the normal
14 Emacs commands to move around in this buffer, and special Dired
15 commands to operate on the listed files.
17 The Dired buffer is ``read-only,'' and inserting text in it is not
18 allowed. Ordinary printing characters such as @kbd{d} and @kbd{x} are
19 redefined for special Dired commands. Some Dired commands @dfn{mark}
20 or @dfn{flag} the @dfn{current file} (that is, the file on the current
21 line); other commands operate on the marked files or on the flagged
22 files. You first mark certain files in order to operate on all of
23 them with one command.
25 The Dired-X package provides various extra features for Dired mode.
26 @xref{Top, Dired-X,,dired-x, Dired Extra Version 2 User's Manual}.
28 You can also view a list of files in a directory with @kbd{C-x C-d}
29 (@code{list-directory}). Unlike Dired, this command does not allow
30 you to operate on the listed files. @xref{Directories}.
33 * Enter: Dired Enter. How to invoke Dired.
34 * Navigation: Dired Navigation. Special motion commands in the Dired buffer.
35 * Deletion: Dired Deletion. Deleting files with Dired.
36 * Flagging Many Files:: Flagging files based on their names.
37 * Visit: Dired Visiting. Other file operations through Dired.
38 * Marks vs Flags:: Flagging for deletion vs marking.
39 * Operating on Files:: How to copy, rename, print, compress, etc.
40 either one file or several files.
41 * Shell Commands in Dired:: Running a shell command on the marked files.
42 * Transforming File Names:: Using patterns to rename multiple files.
43 * Comparison in Dired:: Running `diff' by way of Dired.
44 * Subdirectories in Dired:: Adding subdirectories to the Dired buffer.
46 * Subdir Switches:: Subdirectory switches in Dired.
48 * Subdirectory Motion:: Moving across subdirectories, and up and down.
49 * Hiding Subdirectories:: Making subdirectories visible or invisible.
50 * Updating: Dired Updating. Discarding lines for files of no interest.
51 * Find: Dired and Find. Using `find' to choose the files for Dired.
52 * Wdired:: Operating on files by editing the Dired buffer.
53 * Image-Dired:: Viewing image thumbnails in Dired.
54 * Misc: Misc Dired Features. Various other features.
58 @section Entering Dired
62 @vindex dired-listing-switches
63 To invoke Dired, type @kbd{C-x d} (@code{dired}). This reads a
64 directory name using the minibuffer, and opens a @dfn{Dired buffer}
65 listing the files in that directory. You can also supply a wildcard
66 file name pattern as the minibuffer argument, in which case the Dired
67 buffer lists all files matching that pattern. The usual history and
68 completion commands can be used in the minibuffer; in particular,
69 @kbd{M-n} puts the name of the visited file (if any) in the minibuffer
70 (@pxref{Minibuffer History}).
72 You can also invoke Dired by giving @kbd{C-x C-f} (@code{find-file})
75 The variable @code{dired-listing-switches} specifies the options to
76 give to @code{ls} for listing the directory; this string @emph{must}
77 contain @samp{-l}. If you use a numeric prefix argument with the
78 @code{dired} command, you can specify the @code{ls} switches with the
79 minibuffer before you enter the directory specification. No matter
80 how they are specified, the @code{ls} switches can include short
81 options (that is, single characters) requiring no arguments, and long
82 options (starting with @samp{--}) whose arguments are specified with
85 On MS-Windows and MS-DOS systems, Emacs @emph{emulates} @code{ls};
86 see @ref{ls in Lisp}, for options and peculiarities of that emulation.
88 @findex dired-other-window
90 @findex dired-other-frame
92 To display the Dired buffer in another window rather than in the
93 selected window, use @kbd{C-x 4 d} (@code{dired-other-window}) instead
94 of @kbd{C-x d}. @kbd{C-x 5 d} (@code{dired-other-frame}) uses a
95 separate frame to display the Dired buffer.
97 @node Dired Navigation
98 @section Navigation in the Dired Buffer
100 @kindex C-n @r{(Dired)}
101 @kindex C-p @r{(Dired)}
102 All the usual Emacs cursor motion commands are available in Dired
103 buffers. The keys @kbd{C-n} and @kbd{C-p} are redefined to put the
104 cursor at the beginning of the file name on the line, rather than at
105 the beginning of the line.
107 @kindex SPC @r{(Dired)}
108 For extra convenience, @key{SPC} and @kbd{n} in Dired are equivalent
109 to @kbd{C-n}. @kbd{p} is equivalent to @kbd{C-p}. (Moving by lines
110 is so common in Dired that it deserves to be easy to type.) @key{DEL}
111 (move up and unflag) is also often useful simply for moving up
112 (@pxref{Dired Deletion}).
114 @findex dired-goto-file
115 @kindex j @r{(Dired)}
116 @kbd{j} (@code{dired-goto-file}) prompts for a file name using the
117 minibuffer, and moves point to the line in the Dired buffer describing
120 @cindex searching Dired buffers
121 @vindex dired-isearch-filenames
122 @kbd{M-s f C-s} (@code{dired-isearch-filenames}) performs a forward
123 incremental search in the Dired buffer, looking for matches only
124 amongst the file names and ignoring the rest of the text in the
125 buffer. @kbd{M-s f M-C-s} (@code{dired-isearch-filenames-regexp})
126 does the same, using a regular expression search. If you change the
127 variable @code{dired-isearch-filenames} to @code{t}, then the
128 usual search commands also limit themselves to the file names; for
129 instance, @kbd{C-s} behaves like @kbd{M-s f C-s}. If the value is
130 @code{dwim}, then search commands match the file names only when point
131 was on a file name initially. @xref{Search}, for information about
134 Some additional navigation commands are available when the Dired
135 buffer includes several directories. @xref{Subdirectory Motion}.
138 @section Deleting Files with Dired
139 @cindex flagging files (in Dired)
140 @cindex deleting files (in Dired)
142 One of the most frequent uses of Dired is to first @dfn{flag} files for
143 deletion, then delete the files that were flagged.
147 Flag this file for deletion.
149 Remove deletion flag on this line.
151 Move point to previous line and remove the deletion flag on that line.
153 Delete the files that are flagged for deletion.
156 @kindex d @r{(Dired)}
157 @findex dired-flag-file-deletion
158 You can flag a file for deletion by moving to the line describing
159 the file and typing @kbd{d} (@code{dired-flag-file-deletion}). The
160 deletion flag is visible as a @samp{D} at the beginning of the line.
161 This command moves point to the next line, so that repeated @kbd{d}
162 commands flag successive files. A numeric argument serves as a repeat
165 @kindex u @r{(Dired deletion)}
166 @kindex DEL @r{(Dired)}
167 The reason for flagging files for deletion, rather than deleting
168 files immediately, is to reduce the danger of deleting a file
169 accidentally. Until you direct Dired to delete the flagged files, you
170 can remove deletion flags using the commands @kbd{u} and @key{DEL}.
171 @kbd{u} (@code{dired-unmark}) works just like @kbd{d}, but removes
172 flags rather than making flags. @key{DEL}
173 (@code{dired-unmark-backward}) moves upward, removing flags; it is
174 like @kbd{u} with argument @minus{}1.
176 @kindex x @r{(Dired)}
177 @findex dired-do-flagged-delete
178 To delete the flagged files, type @kbd{x}
179 (@code{dired-do-flagged-delete}). This command first displays a list
180 of all the file names flagged for deletion, and requests confirmation
181 with @kbd{yes}. If you confirm, Dired deletes the flagged files, then
182 deletes their lines from the text of the Dired buffer. The Dired
183 buffer, with somewhat fewer lines, remains selected.
185 If you answer @kbd{no} or quit with @kbd{C-g} when asked to confirm, you
186 return immediately to Dired, with the deletion flags still present in
187 the buffer, and no files actually deleted.
189 @cindex recursive deletion
190 @vindex dired-recursive-deletes
191 You can delete empty directories just like other files, but normally
192 Dired cannot delete directories that are nonempty. If the variable
193 @code{dired-recursive-deletes} is non-@code{nil}, then Dired can
194 delete nonempty directories including all their contents. That can
197 @vindex delete-by-moving-to-trash
198 On some systems, there is a facility called the ``Trash'' or
199 ``Recycle Bin'', but Emacs does @emph{not} use it by default. Thus,
200 when you delete a file in Dired, it is gone forever. However, you can
201 tell Emacs to use the Trash for file deletion, by changing the
202 variable @code{delete-by-moving-to-trash} to @code{t}. @xref{Misc
203 File Ops}, for more information about the Trash.
205 @node Flagging Many Files
206 @section Flagging Many Files at Once
207 @cindex flagging many files for deletion (in Dired)
209 The @kbd{#}, @kbd{~}, @kbd{.}, @kbd{% &}, and @kbd{% d} commands
210 flag many files for deletion, based on their file names:
214 Flag all auto-save files (files whose names start and end with @samp{#})
215 for deletion (@pxref{Auto Save}).
218 Flag all backup files (files whose names end with @samp{~}) for deletion
221 @item .@: @r{(Period)}
222 Flag excess numeric backup files for deletion. The oldest and newest
223 few backup files of any one file are exempt; the middle ones are
227 Flag for deletion all files with certain kinds of names which suggest
228 you could easily create those files again.
230 @item % d @var{regexp} @key{RET}
231 Flag for deletion all files whose names match the regular expression
235 @kindex # @r{(Dired)}
236 @findex dired-flag-auto-save-files
237 @cindex deleting auto-save files
238 @kbd{#} (@code{dired-flag-auto-save-files}) flags all files whose
239 names look like auto-save files---that is, files whose names begin and
240 end with @samp{#}. @xref{Auto Save}.
242 @kindex ~ @r{(Dired)}
243 @findex dired-flag-backup-files
244 @kbd{~} (@code{dired-flag-backup-files}) flags all files whose names
245 say they are backup files---that is, files whose names end in
246 @samp{~}. @xref{Backup}.
248 @kindex . @r{(Dired)}
249 @vindex dired-kept-versions
250 @findex dired-clean-directory
251 @kbd{.} (period, @code{dired-clean-directory}) flags just some of
252 the backup files for deletion: all but the oldest few and newest few
253 backups of any one file. Normally, the number of newest versions kept
254 for each file is given by the variable @code{dired-kept-versions}
255 (@strong{not} @code{kept-new-versions}; that applies only when
256 saving). The number of oldest versions to keep is given by the
257 variable @code{kept-old-versions}.
259 Period with a positive numeric argument, as in @kbd{C-u 3 .},
260 specifies the number of newest versions to keep, overriding
261 @code{dired-kept-versions}. A negative numeric argument overrides
262 @code{kept-old-versions}, using minus the value of the argument to
263 specify the number of oldest versions of each file to keep.
265 @kindex % & @r{(Dired)}
266 @findex dired-flag-garbage-files
267 @vindex dired-garbage-files-regexp
268 @cindex deleting some backup files
269 @kbd{% &} (@code{dired-flag-garbage-files}) flags files whose names
270 match the regular expression specified by the variable
271 @code{dired-garbage-files-regexp}. By default, this matches certain
272 files produced by @TeX{}, @samp{.bak} files, and the @samp{.orig} and
273 @samp{.rej} files produced by @code{patch}.
275 @findex dired-flag-files-regexp
276 @kindex % d @r{(Dired)}
277 @kbd{% d} flags all files whose names match a specified regular
278 expression (@code{dired-flag-files-regexp}). Only the non-directory
279 part of the file name is used in matching. You can use @samp{^} and
280 @samp{$} to anchor matches. You can exclude certain subdirectories
281 from marking by hiding them while you use @kbd{% d}. @xref{Hiding
285 @section Visiting Files in Dired
287 There are several Dired commands for visiting or examining the files
288 listed in the Dired buffer. All of them apply to the current line's
289 file; if that file is really a directory, these commands invoke Dired on
290 that subdirectory (making a separate Dired buffer).
294 @kindex f @r{(Dired)}
295 @findex dired-find-file
296 Visit the file described on the current line, like typing @kbd{C-x C-f}
297 and supplying that file name (@code{dired-find-file}). @xref{Visiting}.
301 @kindex RET @r{(Dired)}
302 @kindex e @r{(Dired)}
303 Equivalent to @kbd{f}.
305 @ignore @c This command seems too risky to document at all.
307 @kindex a @r{(Dired)}
308 @findex dired-find-alternate-file
309 Like @kbd{f}, but replaces the contents of the Dired buffer with
310 that of an alternate file or directory (@code{dired-find-alternate-file}).
314 @kindex o @r{(Dired)}
315 @findex dired-find-file-other-window
316 Like @kbd{f}, but uses another window to display the file's buffer
317 (@code{dired-find-file-other-window}). The Dired buffer remains visible
318 in the first window. This is like using @kbd{C-x 4 C-f} to visit the
319 file. @xref{Windows}.
322 @kindex C-o @r{(Dired)}
323 @findex dired-display-file
324 Visit the file described on the current line, and display the buffer in
325 another window, but do not select that window (@code{dired-display-file}).
329 @findex dired-mouse-find-file-other-window
330 Visit the file named by the line you click on
331 (@code{dired-mouse-find-file-other-window}). This uses another window
332 to display the file, like the @kbd{o} command.
335 @kindex v @r{(Dired)}
336 @findex dired-view-file
337 View the file described on the current line, using @kbd{M-x view-file}
338 (@code{dired-view-file}). Viewing a file with @code{view-file} is
339 like visiting it, but is slanted toward moving around in the file
340 conveniently and does not allow changing the file. @xref{Misc File
341 Ops, View File, Miscellaneous File Operations}.
344 @kindex ^ @r{(Dired)}
345 @findex dired-up-directory
346 Visit the parent directory of the current directory
347 (@code{dired-up-directory}). This is equivalent to moving to the line
348 for @file{..} and typing @kbd{f} there.
352 @section Dired Marks vs. Flags
354 @cindex marking many files (in Dired)
355 Instead of flagging a file with @samp{D}, you can @dfn{mark} the
356 file with some other character (usually @samp{*}). Most Dired
357 commands to operate on files use the files marked with @samp{*}. The
358 only command that operates on flagged files is @kbd{x}, which deletes
361 Here are some commands for marking with @samp{*}, for unmarking, and
362 for operating on marks. (@xref{Dired Deletion}, for commands to flag
368 @kindex m @r{(Dired)}
369 @kindex * m @r{(Dired)}
371 Mark the current file with @samp{*} (@code{dired-mark}). With a numeric
372 argument @var{n}, mark the next @var{n} files starting with the current
373 file. (If @var{n} is negative, mark the previous @minus{}@var{n}
377 @kindex * * @r{(Dired)}
378 @findex dired-mark-executables
379 @cindex marking executable files (in Dired)
380 Mark all executable files with @samp{*}
381 (@code{dired-mark-executables}). With a numeric argument, unmark all
385 @kindex * @@ @r{(Dired)}
386 @findex dired-mark-symlinks
387 @cindex marking symbolic links (in Dired)
388 Mark all symbolic links with @samp{*} (@code{dired-mark-symlinks}).
389 With a numeric argument, unmark all those files.
392 @kindex * / @r{(Dired)}
393 @findex dired-mark-directories
394 @cindex marking subdirectories (in Dired)
395 Mark with @samp{*} all files which are directories, except for
396 @file{.} and @file{..} (@code{dired-mark-directories}). With a numeric
397 argument, unmark all those files.
400 @kindex * s @r{(Dired)}
401 @findex dired-mark-subdir-files
402 Mark all the files in the current subdirectory, aside from @file{.}
403 and @file{..} (@code{dired-mark-subdir-files}).
407 @kindex u @r{(Dired)}
408 @kindex * u @r{(Dired)}
410 Remove any mark on this line (@code{dired-unmark}).
414 @kindex * DEL @r{(Dired)}
415 @findex dired-unmark-backward
416 @cindex unmarking files (in Dired)
417 Move point to previous line and remove any mark on that line
418 (@code{dired-unmark-backward}).
422 @kindex * ! @r{(Dired)}
423 @kindex U @r{(Dired)}
424 @findex dired-unmark-all-marks
425 Remove all marks from all the files in this Dired buffer
426 (@code{dired-unmark-all-marks}).
428 @item * ? @var{markchar}
430 @kindex * ? @r{(Dired)}
431 @kindex M-DEL @r{(Dired)}
432 @findex dired-unmark-all-files
433 Remove all marks that use the character @var{markchar}
434 (@code{dired-unmark-all-files}). The argument is a single
435 character---do not use @key{RET} to terminate it. See the description
436 of the @kbd{* c} command below, which lets you replace one mark
437 character with another.
439 With a numeric argument, this command queries about each marked file,
440 asking whether to remove its mark. You can answer @kbd{y} meaning yes,
441 @kbd{n} meaning no, or @kbd{!} to remove the marks from the remaining
442 files without asking about them.
446 @findex dired-next-marked-file
447 @kindex * C-n @r{(Dired)}
448 @kindex M-@} @r{(Dired)}
449 Move down to the next marked file (@code{dired-next-marked-file})
450 A file is ``marked'' if it has any kind of mark.
454 @findex dired-prev-marked-file
455 @kindex * C-p @r{(Dired)}
456 @kindex M-@{ @r{(Dired)}
457 Move up to the previous marked file (@code{dired-prev-marked-file})
461 @kindex t @r{(Dired)}
462 @kindex * t @r{(Dired)}
463 @findex dired-toggle-marks
464 @cindex toggling marks (in Dired)
465 Toggle all marks (@code{dired-toggle-marks}): files marked with @samp{*}
466 become unmarked, and unmarked files are marked with @samp{*}. Files
467 marked in any other way are not affected.
469 @item * c @var{old-markchar} @var{new-markchar}
470 @kindex * c @r{(Dired)}
471 @findex dired-change-marks
472 Replace all marks that use the character @var{old-markchar} with marks
473 that use the character @var{new-markchar} (@code{dired-change-marks}).
474 This command is the primary way to create or use marks other than
475 @samp{*} or @samp{D}. The arguments are single characters---do not use
476 @key{RET} to terminate them.
478 You can use almost any character as a mark character by means of this
479 command, to distinguish various classes of files. If @var{old-markchar}
480 is a space (@samp{ }), then the command operates on all unmarked files;
481 if @var{new-markchar} is a space, then the command unmarks the files it
484 To illustrate the power of this command, here is how to put @samp{D}
485 flags on all the files that have no marks, while unflagging all those
486 that already have @samp{D} flags:
489 * c D t * c SPC D * c t SPC
492 This assumes that no files were already marked with @samp{t}.
494 @item % m @var{regexp} @key{RET}
495 @itemx * % @var{regexp} @key{RET}
496 @findex dired-mark-files-regexp
497 @kindex % m @r{(Dired)}
498 @kindex * % @r{(Dired)}
499 Mark (with @samp{*}) all files whose names match the regular expression
500 @var{regexp} (@code{dired-mark-files-regexp}). This command is like
501 @kbd{% d}, except that it marks files with @samp{*} instead of flagging
504 Only the non-directory part of the file name is used in matching. Use
505 @samp{^} and @samp{$} to anchor matches. You can exclude
506 subdirectories by temporarily hiding them (@pxref{Hiding
509 @item % g @var{regexp} @key{RET}
510 @findex dired-mark-files-containing-regexp
511 @kindex % g @r{(Dired)}
512 @cindex finding files containing regexp matches (in Dired)
513 Mark (with @samp{*}) all files whose @emph{contents} contain a match for
514 the regular expression @var{regexp}
515 (@code{dired-mark-files-containing-regexp}). This command is like
516 @kbd{% m}, except that it searches the file contents instead of the file
522 @kindex C-_ @r{(Dired)}
524 Undo changes in the Dired buffer, such as adding or removing
525 marks (@code{dired-undo}). @emph{This command does not revert the
526 actual file operations, nor recover lost files!} It just undoes
527 changes in the buffer itself.
529 In some cases, using this after commands that operate on files can
530 cause trouble. For example, after renaming one or more files,
531 @code{dired-undo} restores the original names in the Dired buffer,
532 which gets the Dired buffer out of sync with the actual contents of
536 @node Operating on Files
537 @section Operating on Files
538 @cindex operating on files in Dired
540 This section describes the basic Dired commands to operate on one file
541 or several files. All of these commands are capital letters; all of
542 them use the minibuffer, either to read an argument or to ask for
543 confirmation, before they act. All of them let you specify the
544 files to manipulate in these ways:
548 If you give the command a numeric prefix argument @var{n}, it operates
549 on the next @var{n} files, starting with the current file. (If @var{n}
550 is negative, the command operates on the @minus{}@var{n} files preceding
554 Otherwise, if some files are marked with @samp{*}, the command operates
558 Otherwise, the command operates on the current file only.
562 Certain other Dired commands, such as @kbd{!} and the @samp{%}
563 commands, use the same conventions to decide which files to work on.
565 @vindex dired-dwim-target
566 @cindex two directories (in Dired)
567 Commands which ask for a destination directory, such as those which
568 copy and rename files or create links for them, try to guess the default
569 target directory for the operation. Normally, they suggest the Dired
570 buffer's default directory, but if the variable @code{dired-dwim-target}
571 is non-@code{nil}, and if there is another Dired buffer displayed in the
572 next window, that other buffer's directory is suggested instead.
574 Here are the file-manipulating Dired commands that operate on files.
577 @findex dired-do-copy
578 @kindex C @r{(Dired)}
579 @cindex copying files (in Dired)
580 @item C @var{new} @key{RET}
581 Copy the specified files (@code{dired-do-copy}). The argument @var{new}
582 is the directory to copy into, or (if copying a single file) the new
583 name. This is like the shell command @code{cp}.
585 @vindex dired-copy-preserve-time
586 If @code{dired-copy-preserve-time} is non-@code{nil}, then copying
587 with this command preserves the modification time of the old file in
588 the copy, like @samp{cp -p}.
590 @vindex dired-recursive-copies
591 @cindex recursive copying
592 The variable @code{dired-recursive-copies} controls whether to copy
593 directories recursively (like @samp{cp -r}). The default is
594 @code{nil}, which means that directories cannot be copied.
597 @findex dired-do-delete
598 @kindex D @r{(Dired)}
599 Delete the specified files (@code{dired-do-delete}). This is like the
600 shell command @code{rm}.
602 Like the other commands in this section, this command operates on the
603 @emph{marked} files, or the next @var{n} files. By contrast, @kbd{x}
604 (@code{dired-do-flagged-delete}) deletes all @dfn{flagged} files.
606 @findex dired-do-rename
607 @kindex R @r{(Dired)}
608 @cindex renaming files (in Dired)
609 @cindex moving files (in Dired)
610 @item R @var{new} @key{RET}
611 Rename the specified files (@code{dired-do-rename}). If you rename a
612 single file, the argument @var{new} is the new name of the file. If
613 you rename several files, the argument @var{new} is the directory into
614 which to move the files (this is like the shell command @code{mv}).
616 Dired automatically changes the visited file name of buffers associated
617 with renamed files so that they refer to the new names.
619 @findex dired-do-hardlink
620 @kindex H @r{(Dired)}
621 @cindex hard links (in Dired)
622 @item H @var{new} @key{RET}
623 Make hard links to the specified files (@code{dired-do-hardlink}).
624 This is like the shell command @code{ln}. The argument @var{new} is
625 the directory to make the links in, or (if making just one link) the
626 name to give the link.
628 @findex dired-do-symlink
629 @kindex S @r{(Dired)}
630 @cindex symbolic links (creation in Dired)
631 @item S @var{new} @key{RET}
632 Make symbolic links to the specified files (@code{dired-do-symlink}).
633 This is like @samp{ln -s}. The argument @var{new} is the directory to
634 make the links in, or (if making just one link) the name to give the
637 @findex dired-do-chmod
638 @kindex M @r{(Dired)}
639 @cindex changing file permissions (in Dired)
640 @item M @var{modespec} @key{RET}
641 Change the mode (also called ``permission bits'') of the specified files
642 (@code{dired-do-chmod}). This uses the @code{chmod} program, so
643 @var{modespec} can be any argument that @code{chmod} can handle.
645 @findex dired-do-chgrp
646 @kindex G @r{(Dired)}
647 @cindex changing file group (in Dired)
648 @item G @var{newgroup} @key{RET}
649 Change the group of the specified files to @var{newgroup}
650 (@code{dired-do-chgrp}).
652 @findex dired-do-chown
653 @kindex O @r{(Dired)}
654 @cindex changing file owner (in Dired)
655 @item O @var{newowner} @key{RET}
656 Change the owner of the specified files to @var{newowner}
657 (@code{dired-do-chown}). (On most systems, only the superuser can do
660 @vindex dired-chown-program
661 The variable @code{dired-chown-program} specifies the name of the
662 program to use to do the work (different systems put @code{chown} in
665 @findex dired-do-touch
666 @kindex T @r{(Dired)}
667 @cindex changing file time (in Dired)
668 @item T @var{timestamp} @key{RET}
669 Touch the specified files (@code{dired-do-touch}). This means
670 updating their modification times to the present time. This is like
671 the shell command @code{touch}.
673 @findex dired-do-print
674 @kindex P @r{(Dired)}
675 @cindex printing files (in Dired)
676 @item P @var{command} @key{RET}
677 Print the specified files (@code{dired-do-print}). You must specify the
678 command to print them with, but the minibuffer starts out with a
679 suitable guess made using the variables @code{lpr-command} and
680 @code{lpr-switches} (the same variables that @code{lpr-buffer} uses;
683 @findex dired-do-compress
684 @kindex Z @r{(Dired)}
685 @cindex compressing files (in Dired)
687 Compress the specified files (@code{dired-do-compress}). If the file
688 appears to be a compressed file already, uncompress it instead.
690 @findex dired-do-load
691 @kindex L @r{(Dired)}
692 @cindex loading several files (in Dired)
694 Load the specified Emacs Lisp files (@code{dired-do-load}).
695 @xref{Lisp Libraries}.
697 @findex dired-do-byte-compile
698 @kindex B @r{(Dired)}
699 @cindex byte-compiling several files (in Dired)
701 Byte compile the specified Emacs Lisp files
702 (@code{dired-do-byte-compile}). @xref{Byte Compilation,, Byte
703 Compilation, elisp, The Emacs Lisp Reference Manual}.
705 @kindex A @r{(Dired)}
706 @findex dired-do-search
707 @cindex search multiple files (in Dired)
708 @item A @var{regexp} @key{RET}
709 Search all the specified files for the regular expression @var{regexp}
710 (@code{dired-do-search}).
712 This command is a variant of @code{tags-search}. The search stops at
713 the first match it finds; use @kbd{M-,} to resume the search and find
714 the next match. @xref{Tags Search}.
716 @kindex Q @r{(Dired)}
717 @findex dired-do-query-replace-regexp
718 @cindex search and replace in multiple files (in Dired)
719 @item Q @var{regexp} @key{RET} @var{to} @key{RET}
720 Perform @code{query-replace-regexp} on each of the specified files,
721 replacing matches for @var{regexp} with the string
722 @var{to} (@code{dired-do-query-replace-regexp}).
724 This command is a variant of @code{tags-query-replace}. If you exit the
725 query replace loop, you can use @kbd{M-,} to resume the scan and replace
726 more matches. @xref{Tags Search}.
729 @node Shell Commands in Dired
730 @section Shell Commands in Dired
731 @cindex shell commands, Dired
733 @findex dired-do-shell-command
734 @kindex ! @r{(Dired)}
735 @kindex X @r{(Dired)}
736 The Dired command @kbd{!} (@code{dired-do-shell-command}) reads a
737 shell command string in the minibuffer and runs that shell command on
738 one or more files. The files that the shell command operates on are
739 determined in the usual way for Dired commands (@pxref{Operating on
740 Files}). The command @kbd{X} is a synonym for @kbd{!}.
742 The command @kbd{&} (@code{dired-do-async-shell-command}) does the
743 same, except that it runs the shell command asynchronously. You can
744 also do this with @kbd{!}, by appending a @samp{&} character to the
745 end of the shell command.
747 For both @kbd{!} and @kbd{&}, the working directory for the shell
748 command is the top-level directory of the Dired buffer.
750 If you tell @kbd{!} or @kbd{&} to operate on more than one file, the
751 shell command string determines how those files are passed to the
756 If you use @samp{*} surrounded by whitespace in the command string,
757 then the command runs just once, with the list of file names
758 substituted for the @samp{*}. The order of file names is the order of
759 appearance in the Dired buffer.
761 Thus, @kbd{! tar cf foo.tar * @key{RET}} runs @code{tar} on the entire
762 list of file names, putting them into one tar file @file{foo.tar}.
764 If you want to use @samp{*} as a shell wildcard with whitespace around
765 it, write @samp{*""}. In the shell, this is equivalent to @samp{*};
766 but since the @samp{*} is not surrounded by whitespace, Dired does not
770 Otherwise, if the command string contains @samp{?} surrounded by
771 whitespace, Emacs runs the shell command once @emph{for each file},
772 substituting the current file name for @samp{?} each time. You can
773 use @samp{?} more than once in the command; the same file name
774 replaces each occurrence.
777 If the command string contains neither @samp{*} nor @samp{?}, Emacs
778 runs the shell command once for each file, adding the file name is
779 added at the end. For example, @kbd{! uudecode @key{RET}} runs
780 @code{uudecode} on each file.
783 To iterate over the file names in a more complicated fashion, use an
784 explicit shell loop. For example, here is how to uuencode each file,
785 making the output file name by appending @samp{.uu} to the input file
789 for file in * ; do uuencode "$file" "$file" >"$file".uu; done
792 The @kbd{!} and @kbd{&} commands do not attempt to update the Dired
793 buffer to show new or modified files, because they don't know what
794 files will be changed. Use the @kbd{g} command to update the Dired
795 buffer (@pxref{Dired Updating}).
797 @xref{Single Shell}, for information about running shell commands
800 @node Transforming File Names
801 @section Transforming File Names in Dired
803 This section describes Dired commands which alter file names in a
804 systematic way. Each command operates on some or all of the marked
805 files, using a new name made by transforming the existing name.
807 Like the basic Dired file-manipulation commands (@pxref{Operating on
808 Files}), the commands described here operate either on the next
809 @var{n} files, or on all files marked with @samp{*}, or on the current
810 file. (To mark files, use the commands described in @ref{Marks vs
813 All of the commands described in this section work
814 @emph{interactively}: they ask you to confirm the operation for each
815 candidate file. Thus, you can select more files than you actually
816 need to operate on (e.g., with a regexp that matches many files), and
817 then filter the selected names by typing @kbd{y} or @kbd{n} when the
818 command prompts for confirmation.
822 @kindex % u @r{(Dired)}
823 @cindex upcase file names
825 Rename each of the selected files to an upper-case name
826 (@code{dired-upcase}). If the old file names are @file{Foo}
827 and @file{bar}, the new names are @file{FOO} and @file{BAR}.
830 @findex dired-downcase
831 @kindex % l @r{(Dired)}
832 @cindex downcase file names
833 Rename each of the selected files to a lower-case name
834 (@code{dired-downcase}). If the old file names are @file{Foo} and
835 @file{bar}, the new names are @file{foo} and @file{bar}.
837 @item % R @var{from} @key{RET} @var{to} @key{RET}
838 @kindex % R @r{(Dired)}
839 @findex dired-do-rename-regexp
840 @itemx % C @var{from} @key{RET} @var{to} @key{RET}
841 @kindex % C @r{(Dired)}
842 @findex dired-do-copy-regexp
843 @itemx % H @var{from} @key{RET} @var{to} @key{RET}
844 @kindex % H @r{(Dired)}
845 @findex dired-do-hardlink-regexp
846 @itemx % S @var{from} @key{RET} @var{to} @key{RET}
847 @kindex % S @r{(Dired)}
848 @findex dired-do-symlink-regexp
849 These four commands rename, copy, make hard links and make soft links,
850 in each case computing the new name by regular-expression substitution
851 from the name of the old file.
854 The four regular-expression substitution commands effectively
855 perform a search-and-replace on the selected file names. They read
856 two arguments: a regular expression @var{from}, and a substitution
857 pattern @var{to}; they match each ``old'' file name against
858 @var{from}, and then replace the matching part with @var{to}. You can
859 use @samp{\&} and @samp{\@var{digit}} in @var{to} to refer to all or
860 part of what the pattern matched in the old file name, as in
861 @code{replace-regexp} (@pxref{Regexp Replace}). If the regular
862 expression matches more than once in a file name, only the first match
865 For example, @kbd{% R ^.*$ @key{RET} x-\& @key{RET}} renames each
866 selected file by prepending @samp{x-} to its name. The inverse of this,
867 removing @samp{x-} from the front of each file name, is also possible:
868 one method is @kbd{% R ^x-\(.*\)$ @key{RET} \1 @key{RET}}; another is
869 @kbd{% R ^x- @key{RET} @key{RET}}. (Use @samp{^} and @samp{$} to anchor
870 matches that should span the whole file name.)
872 Normally, the replacement process does not consider the files'
873 directory names; it operates on the file name within the directory. If
874 you specify a numeric argument of zero, then replacement affects the
875 entire absolute file name including directory name. (A non-zero
876 argument specifies the number of files to operate on.)
878 You may want to select the set of files to operate on using the same
879 regexp @var{from} that you will use to operate on them. To do this,
880 mark those files with @kbd{% m @var{from} @key{RET}}, then use the
881 same regular expression in the command to operate on the files. To
882 make this more convenient, the @kbd{%} commands to operate on files
883 use the last regular expression specified in any @kbd{%} command as a
886 @node Comparison in Dired
887 @section File Comparison with Dired
888 @cindex file comparison (in Dired)
889 @cindex compare files (in Dired)
891 Here are two Dired commands that compare specified files using
892 @code{diff}. They show the output in a buffer using Diff mode
893 (@pxref{Comparing Files}).
898 @kindex = @r{(Dired)}
899 Compare the current file (the file at point) with another file (the
900 file at the mark) using the @code{diff} program (@code{dired-diff}).
901 The file at the mark is the first argument of @code{diff}, and the
902 file at point is the second argument. This refers to the ordinary
903 Emacs mark, not Dired marks; use @kbd{C-@key{SPC}}
904 (@code{set-mark-command}) to set the mark at the first file's line
905 (@pxref{Setting Mark}).
907 @findex dired-backup-diff
908 @kindex M-= @r{(Dired)}
910 Compare the current file with its latest backup file
911 (@code{dired-backup-diff}). If the current file is itself a backup,
912 compare it with the file it is a backup of; this way, you can compare
913 a file with any one of its backups.
915 The backup file is the first file given to @code{diff}.
918 @node Subdirectories in Dired
919 @section Subdirectories in Dired
920 @cindex subdirectories in Dired
921 @cindex expanding subdirectories in Dired
923 A Dired buffer displays just one directory in the normal case;
924 but you can optionally include its subdirectories as well.
926 The simplest way to include multiple directories in one Dired buffer is
927 to specify the options @samp{-lR} for running @code{ls}. (If you give a
928 numeric argument when you run Dired, then you can specify these options
929 in the minibuffer.) That produces a recursive directory listing showing
930 all subdirectories at all levels.
932 More often, you will want to show only specific subdirectories. You
933 can do this with the @kbd{i} command:
936 @findex dired-maybe-insert-subdir
937 @kindex i @r{(Dired)}
939 @cindex inserted subdirectory (Dired)
940 @cindex in-situ subdirectory (Dired)
941 Insert the contents of a subdirectory later in the buffer.
944 Use the @kbd{i} (@code{dired-maybe-insert-subdir}) command on a line
945 that describes a file which is a directory. It inserts the contents of
946 that directory into the same Dired buffer, and moves there. Inserted
947 subdirectory contents follow the top-level directory of the Dired
948 buffer, just as they do in @samp{ls -lR} output.
950 If the subdirectory's contents are already present in the buffer, the
951 @kbd{i} command just moves to it.
953 In either case, @kbd{i} sets the Emacs mark before moving, so @kbd{C-u
954 C-@key{SPC}} takes you back to the old position in the buffer (the line
955 describing that subdirectory). You can also use @samp{^} to return
956 to the parent directory in the same Dired buffer.
958 Use the @kbd{l} command (@code{dired-do-redisplay}) to update the
959 subdirectory's contents. Use @kbd{C-u k} on the subdirectory header
960 line to delete the subdirectory (@pxref{Dired Updating}). You can also
961 hide and show inserted subdirectories (@pxref{Hiding Subdirectories}).
964 @include dired-xtra.texi
967 @node Subdirectory Motion
968 @section Moving Over Subdirectories
970 When a Dired buffer lists subdirectories, you can use the page motion
971 commands @kbd{C-x [} and @kbd{C-x ]} to move by entire directories
974 @cindex header line (Dired)
975 @cindex directory header lines
976 The following commands move across, up and down in the tree of
977 directories within one Dired buffer. They move to @dfn{directory header
978 lines}, which are the lines that give a directory's name, at the
979 beginning of the directory's contents.
982 @findex dired-next-subdir
983 @kindex C-M-n @r{(Dired)}
985 Go to next subdirectory header line, regardless of level
986 (@code{dired-next-subdir}).
988 @findex dired-prev-subdir
989 @kindex C-M-p @r{(Dired)}
991 Go to previous subdirectory header line, regardless of level
992 (@code{dired-prev-subdir}).
994 @findex dired-tree-up
995 @kindex C-M-u @r{(Dired)}
997 Go up to the parent directory's header line (@code{dired-tree-up}).
999 @findex dired-tree-down
1000 @kindex C-M-d @r{(Dired)}
1002 Go down in the directory tree, to the first subdirectory's header line
1003 (@code{dired-tree-down}).
1005 @findex dired-prev-dirline
1006 @kindex < @r{(Dired)}
1008 Move up to the previous directory-file line (@code{dired-prev-dirline}).
1009 These lines are the ones that describe a directory as a file in its
1012 @findex dired-next-dirline
1013 @kindex > @r{(Dired)}
1015 Move down to the next directory-file line (@code{dired-prev-dirline}).
1018 @node Hiding Subdirectories
1019 @section Hiding Subdirectories
1020 @cindex hiding subdirectories (Dired)
1021 @cindex showing hidden subdirectories (Dired)
1023 @dfn{Hiding} a subdirectory means to make it invisible, except for its
1028 @findex dired-hide-subdir
1029 @kindex $ @r{(Dired)}
1030 Hide or show the subdirectory that point is in, and move point to the
1031 next subdirectory (@code{dired-hide-subdir}). This is a toggle. A
1032 numeric argument serves as a repeat count.
1035 @findex dired-hide-all
1036 @kindex M-$ @r{(Dired)}
1037 Hide all subdirectories in this Dired buffer, leaving only their header
1038 lines (@code{dired-hide-all}). Or, if any subdirectory is currently
1039 hidden, make all subdirectories visible again. You can use this command
1040 to get an overview in very deep directory trees or to move quickly to
1041 subdirectories far away.
1044 Ordinary Dired commands never consider files inside a hidden
1045 subdirectory. For example, the commands to operate on marked files
1046 ignore files in hidden directories even if they are marked. Thus you
1047 can use hiding to temporarily exclude subdirectories from operations
1048 without having to remove the Dired marks on files in those
1051 @xref{Dired Updating}, for how to insert or delete a subdirectory listing.
1053 @node Dired Updating
1054 @section Updating the Dired Buffer
1055 @cindex updating Dired buffer
1056 @cindex refreshing displayed files
1058 This section describes commands to update the Dired buffer to reflect
1059 outside (non-Dired) changes in the directories and files, and to delete
1060 part of the Dired buffer.
1064 Update the entire contents of the Dired buffer (@code{revert-buffer}).
1067 Update the specified files (@code{dired-do-redisplay}). You specify the
1068 files for @kbd{l} in the same way as for file operations.
1071 Delete the specified @emph{file lines}---not the files, just the lines
1072 (@code{dired-do-kill-lines}).
1075 Toggle between alphabetical order and date/time order
1076 (@code{dired-sort-toggle-or-edit}).
1078 @item C-u s @var{switches} @key{RET}
1079 Refresh the Dired buffer using @var{switches} as
1080 @code{dired-listing-switches}.
1083 @kindex g @r{(Dired)}
1084 @findex revert-buffer @r{(Dired)}
1085 Type @kbd{g} (@code{revert-buffer}) to update the contents of the
1086 Dired buffer, based on changes in the files and directories listed.
1087 This preserves all marks except for those on files that have vanished.
1088 Hidden subdirectories are updated but remain hidden.
1090 @kindex l @r{(Dired)}
1091 @findex dired-do-redisplay
1092 To update only some of the files, type @kbd{l}
1093 (@code{dired-do-redisplay}). Like the Dired file-operating commands,
1094 this command operates on the next @var{n} files (or previous
1095 @minus{}@var{n} files), or on the marked files if any, or on the
1096 current file. Updating the files means reading their current status,
1097 then updating their lines in the buffer to indicate that status.
1099 If you use @kbd{l} on a subdirectory header line, it updates the
1100 contents of the corresponding subdirectory.
1102 @kindex k @r{(Dired)}
1103 @findex dired-do-kill-lines
1104 To delete the specified @emph{file lines} from the buffer---not
1105 delete the files---type @kbd{k} (@code{dired-do-kill-lines}). Like
1106 the file-operating commands, this command operates on the next @var{n}
1107 files, or on the marked files if any; but it does not operate on the
1108 current file as a last resort.
1110 If you use @kbd{k} with a numeric prefix argument to kill the line
1111 for a file that is a directory, which you have inserted in the Dired
1112 buffer as a subdirectory, it deletes that subdirectory from the buffer
1113 as well. Typing @kbd{C-u k} on the header line for a subdirectory
1114 also deletes the subdirectory from the Dired buffer.
1116 The @kbd{g} command brings back any individual lines that you have
1117 killed in this way, but not subdirectories---you must use @kbd{i} to
1118 reinsert a subdirectory.
1120 @cindex Dired sorting
1121 @cindex sorting Dired buffer
1122 @kindex s @r{(Dired)}
1123 @findex dired-sort-toggle-or-edit
1124 The files in a Dired buffers are normally listed in alphabetical order
1125 by file names. Alternatively Dired can sort them by date/time. The
1126 Dired command @kbd{s} (@code{dired-sort-toggle-or-edit}) switches
1127 between these two sorting modes. The mode line in a Dired buffer
1128 indicates which way it is currently sorted---by name, or by date.
1130 @kbd{C-u s @var{switches} @key{RET}} lets you specify a new value for
1131 @code{dired-listing-switches}.
1133 @node Dired and Find
1134 @section Dired and @code{find}
1135 @cindex @code{find} and Dired
1137 You can select a set of files for display in a Dired buffer more
1138 flexibly by using the @command{find} utility to choose the files.
1140 @findex find-name-dired
1141 To search for files with names matching a wildcard pattern use
1142 @kbd{M-x find-name-dired}. It reads arguments @var{directory} and
1143 @var{pattern}, and chooses all the files in @var{directory} or its
1144 subdirectories whose individual names match @var{pattern}.
1146 The files thus chosen are displayed in a Dired buffer, in which the
1147 ordinary Dired commands are available.
1149 @findex find-grep-dired
1150 If you want to test the contents of files, rather than their names,
1151 use @kbd{M-x find-grep-dired}. This command reads two minibuffer
1152 arguments, @var{directory} and @var{regexp}; it chooses all the files
1153 in @var{directory} or its subdirectories that contain a match for
1154 @var{regexp}. It works by running the programs @command{find} and
1155 @command{grep}. See also @kbd{M-x grep-find}, in @ref{Grep
1156 Searching}. Remember to write the regular expression for
1157 @command{grep}, not for Emacs. (An alternative method of showing
1158 files whose contents match a given regexp is the @kbd{% g
1159 @var{regexp}} command, see @ref{Marks vs Flags}.)
1162 The most general command in this series is @kbd{M-x find-dired},
1163 which lets you specify any condition that @command{find} can test. It
1164 takes two minibuffer arguments, @var{directory} and @var{find-args};
1165 it runs @command{find} in @var{directory}, passing @var{find-args} to
1166 tell @command{find} what condition to test. To use this command, you
1167 need to know how to use @command{find}.
1169 @vindex find-ls-option
1170 The format of listing produced by these commands is controlled by the
1171 variable @code{find-ls-option}, whose default value specifies using
1172 options @samp{-ld} for @code{ls}. If your listings are corrupted, you
1173 may need to change the value of this variable.
1176 @findex locate-with-filter
1177 @cindex file database (locate)
1178 @vindex locate-command
1179 The command @kbd{M-x locate} provides a similar interface to the
1180 @command{locate} program. @kbd{M-x locate-with-filter} is similar, but
1181 keeps only files whose names match a given regular expression.
1183 These buffers don't work entirely like ordinary Dired buffers: file
1184 operations work, but do not always automatically update the buffer.
1185 Reverting the buffer with @kbd{g} deletes all inserted subdirectories,
1186 and erases all flags and marks.
1189 @section Editing the Dired Buffer
1192 @findex wdired-change-to-wdired-mode
1193 Wdired is a special mode that allows you to perform file operations
1194 by editing the Dired buffer directly (the ``W'' in ``Wdired'' stands
1195 for ``writable.'') To enter Wdired mode, type @kbd{C-x C-q}
1196 (@code{dired-toggle-read-only}) while in a Dired buffer.
1197 Alternatively, use the @samp{Immediate / Edit File Names} menu item.
1199 @findex wdired-finish-edit
1200 While in Wdired mode, you can rename files by editing the file names
1201 displayed in the Dired buffer. All the ordinary Emacs editing
1202 commands, including rectangle operations and @code{query-replace}, are
1203 available for this. Once you are done editing, type @kbd{C-c C-c}
1204 (@code{wdired-finish-edit}). This applies your changes and switches
1205 back to ordinary Dired mode.
1207 Apart from simply renaming files, you can move a file to another
1208 directory by typing in the new file name (either absolute or
1209 relative). To mark a file for deletion, delete the entire file name.
1210 To change the target of a symbolic link, edit the link target name
1211 which appears next to the link name.
1213 The rest of the text in the buffer, such as the file sizes and
1214 modification dates, is marked read-only, so you can't edit it.
1215 However, if you set @code{wdired-allow-to-change-permissions} to
1216 @code{t}, you can edit the file permissions. For example, you can
1217 change @samp{-rw-r--r--} to @samp{-rw-rw-rw-} to make a file
1218 world-writable. These changes also take effect when you type @kbd{C-c
1222 @section Viewing Image Thumbnails in Dired
1223 @cindex image-dired mode
1226 Image-Dired is a facility for browsing image files. It provides viewing
1227 the images either as thumbnails or in full size, either inside Emacs
1228 or through an external viewer.
1230 @kindex C-t d @r{(Image-Dired)}
1231 @findex image-dired-display-thumbs
1232 To enter Image-Dired, mark the image files you want to look at in
1233 the Dired buffer, using @kbd{m} as usual. Then type @kbd{C-t d}
1234 (@code{image-dired-display-thumbs}). This creates and switches to a
1235 buffer containing image-dired, corresponding to the marked files.
1237 You can also enter Image-Dired directly by typing @kbd{M-x
1238 image-dired}. This prompts for a directory; specify one that has
1239 image files. This creates thumbnails for all the images in that
1240 directory, and displays them all in the ``thumbnail buffer.'' This
1241 takes a long time if the directory contains many image files, and it
1242 asks for confirmation if the number of image files exceeds
1243 @code{image-dired-show-all-from-dir-max-files}.
1245 With point in the thumbnail buffer, you can type @kbd{RET}
1246 (@code{image-dired-display-thumbnail-original-image}) to display a
1247 sized version of it in another window. This sizes the image to fit
1248 the window. Use the arrow keys to move around in the buffer. For
1249 easy browsing, use @kbd{SPC}
1250 (@code{image-dired-display-next-thumbnail-original}) to advance and
1251 display the next image. Typing @kbd{DEL}
1252 (@code{image-dired-display-previous-thumbnail-original}) backs up to
1253 the previous thumbnail and displays that instead.
1255 @vindex image-dired-external-viewer
1256 To view and the image in its original size, either provide a prefix
1257 argument (@kbd{C-u}) before pressing @kbd{RET}, or type
1258 @kbd{C-@key{RET}} (@code{image-dired-thumbnail-display-external}) to
1259 display the image in an external viewer. You must first configure
1260 @code{image-dired-external-viewer}.
1262 You can delete images through Image-Dired also. Type @kbd{d}
1263 (@code{image-dired-flag-thumb-original-file}) to flag the image file
1264 for deletion in the Dired buffer. You can also delete the thumbnail
1265 image from the thumbnail buffer with @kbd{C-d}
1266 (@code{image-dired-delete-char}).
1268 More advanced features include @dfn{image tags}, which are metadata
1269 used to categorize image files. The tags are stored in a plain text
1270 file configured by @code{image-dired-db-file}.
1272 To tag image files, mark them in the dired buffer (you can also mark
1273 files in Dired from the thumbnail buffer by typing @kbd{m}) and type
1274 @kbd{C-t t} (@code{image-dired-tag-files}). This reads the tag name
1275 in the minibuffer. To mark files having a certain tag, type @kbd{C-t f}
1276 (@code{image-dired-mark-tagged-files}). After marking image files
1277 with a certain tag, you can use @kbd{C-t d} to view them.
1279 You can also tag a file directly from the thumbnail buffer by typing
1280 @kbd{t t} and you can remove a tag by typing @kbd{t r}. There is also
1281 a special ``tag'' called ``comment'' for each file (it is not a tag in
1282 the exact same sense as the other tags, it is handled slightly
1283 different). That is used to enter a comment or description about the
1284 image. You comment a file from the thumbnail buffer by typing
1285 @kbd{c}. You will be prompted for a comment. Type @kbd{C-t c} to add
1286 a comment from Dired (@code{image-dired-dired-comment-files}).
1288 Image-Dired also provides simple image manipulation. In the
1289 thumbnail buffer, type @kbd{L} to rotate the original image 90 degrees
1290 anti clockwise, and @kbd{R} to rotate it 90 degrees clockwise. This
1291 rotation is lossless, and uses an external utility called JpegTRAN.
1293 @node Misc Dired Features
1294 @section Other Dired Features
1296 @kindex + @r{(Dired)}
1297 @findex dired-create-directory
1298 The command @kbd{+} (@code{dired-create-directory}) reads a
1299 directory name, and creates the directory if it does not already
1302 @cindex searching multiple files via Dired
1303 The command @kbd{M-s a C-s} (@code{dired-do-isearch}) begins a
1304 ``multi-file'' incremental search on the marked files. If a search
1305 fails at the end of a file, typing @kbd{C-s} advances to the next
1306 marked file and repeats the search; at the end of the last marked
1307 file, the search wraps around to the first marked file. The command
1308 @kbd{M-s a M-C-s} (@code{dired-do-isearch-regexp}) does the same with
1309 a regular expression search. @xref{Repeat Isearch}, for information
1310 about search repetition.
1312 @cindex Adding to the kill ring in Dired.
1313 @kindex w @r{(Dired)}
1314 @findex dired-copy-filename-as-kill
1315 The command @kbd{w} (@code{dired-copy-filename-as-kill}) puts the
1316 names of the marked (or next @var{n}) files into the kill ring, as if
1317 you had killed them with @kbd{C-w}. The names are separated by a
1320 With a zero prefix argument, this uses the absolute file name of
1321 each marked file. With just @kbd{C-u} as the prefix argument, it uses
1322 file names relative to the Dired buffer's default directory. (This
1323 can still contain slashes if in a subdirectory.) As a special case,
1324 if point is on a directory headerline, @kbd{w} gives you the absolute
1325 name of that directory. Any prefix argument or marked files are
1326 ignored in this case.
1328 The main purpose of this command is so that you can yank the file
1329 names into arguments for other Emacs commands. It also displays what
1330 it added to the kill ring, so you can use it to display the list of
1331 currently marked files in the echo area.
1333 @findex dired-compare-directories
1334 The command @kbd{M-x dired-compare-directories} is used to compare
1335 the current Dired buffer with another directory. It marks all the files
1336 that are ``different'' between the two directories. It puts these marks
1337 in all Dired buffers where these files are listed, which of course includes
1340 The default comparison method (used if you type @key{RET} at the
1341 prompt) is to compare just the file names---each file name that does
1342 not appear in the other directory is ``different.'' You can specify
1343 more stringent comparisons by entering a Lisp expression, which can
1344 refer to the variables @code{size1} and @code{size2}, the respective
1345 file sizes; @code{mtime1} and @code{mtime2}, the last modification
1346 times in seconds, as floating point numbers; and @code{fa1} and
1347 @code{fa2}, the respective file attribute lists (as returned by the
1348 function @code{file-attributes}). This expression is evaluated for
1349 each pair of like-named files, and if the expression's value is
1350 non-@code{nil}, those files are considered ``different.''
1352 For instance, the sequence @code{M-x dired-compare-directories
1353 @key{RET} (> mtime1 mtime2) @key{RET}} marks files newer in this
1354 directory than in the other, and marks files older in the other
1355 directory than in this one. It also marks files with no counterpart,
1356 in both directories, as always.
1358 @cindex drag and drop, Dired
1359 On the X window system, Emacs supports the ``drag and drop''
1360 protocol. You can drag a file object from another program, and drop
1361 it onto a Dired buffer; this either moves, copies, or creates a link
1362 to the file in that directory. Precisely which action is taken is
1363 determined by the originating program. Dragging files out of a Dired
1364 buffer is currently not supported.
1367 arch-tag: d105f9b9-fc1b-4c5f-a949-9b2cf3ca2fc1