Dired Marks vs. Flags
Instead of flagging a file with D, you can mark the file with some other character (usually *). Most Dired commands to operate on files use the files marked with *. The only command that operates on flagged files is x, which deletes them. Here are some commands for marking with *, for unmarking, and for operating on marks. (Dired Deletion, for commands to flag and unflag files.)
- m, * m
- Mark the current file with
*(dired-mark). If the region is active, mark all files in the region instead; otherwise, if a numeric argument n is supplied, mark the next n files instead, starting with the current file (if n is negative, mark the previous -n files). If invoked on a subdirectory header line (Subdirectories in Dired), this command marks all the files in that subdirectory. - * N
- Report what the number and size of the marked files are (
dired-number-of-marked-files). - * *
- Mark all executable files with
*(dired-mark-executables). With a numeric argument, unmark all those files. - * @@
- Mark all symbolic links with
*(dired-mark-symlinks). With a numeric argument, unmark all those files. - * /
- Mark with
*all files which are directories, except for.and..(dired-mark-directories). With a numeric argument, unmark all those files. - * s
- Mark all the files in the current subdirectory, aside from
.and..(dired-mark-subdir-files). - u, * u
- Remove any mark on this line (
dired-unmark). If the region is active, unmark all files in the region instead; otherwise, if a numeric argument n is supplied, unmark the next n files instead, starting with the current file (if n is negative, unmark the previous -n files). -
DEL, *DEL - Move point to previous line and remove any mark on that line (
dired-unmark-backward). If the region is active, unmark all files in the region instead; otherwise, if a numeric argument n is supplied, unmark the n preceding files instead, starting with the current file (if n is negative, unmark the next -n files). - * !, U
- Remove all marks from all the files in this Dired buffer (
dired-unmark-all-marks). -
* ? markchar, M-
DEL - Remove all marks that use the character markchar (
dired-unmark-all-files). If invoked withM-=DEL=, the command prompts for markchar. That markchar is a single character—do not useRETto terminate it. See the description of the* ccommand below, which lets you replace one mark character with another. With a numeric argument, this command queries about each marked file, asking whether to remove its mark. You can answerymeaning yes,nmeaning no, or!to remove the marks from the remaining files without asking about them. - * C-n, M-@}
- Move down to the next marked file (
dired-next-marked-file). A file is ``marked'' if it has any kind of mark. - * C-p, M-@{
- Move up to the previous marked file (
dired-prev-marked-file). - t, * t
- Toggle all marks (
dired-toggle-marks): files marked with*become unmarked, and unmarked files are marked with*. Files marked in any other way are not affected. - * c old-markchar new-markchar
- Replace all marks that use the character old-markchar with marks that use the character new-markchar (
dired-change-marks). This command is the primary way to create or use marks other than*orD. The arguments are single characters—do not useRETto terminate them. You can use almost any character as a mark character by means of this command, to distinguish various classes of files. If old-markchar is a space (=), then the command operates on all unmarked files; if /new-markchar/ is a space, then the command unmarks the files it acts on. To illustrate the power of this command, here is how to put =Dflags on all the files that have no marks, while unflagging all those that already haveDflags: @example * c D t * cSPCD * c tSPC@end example This assumes that no files were already marked witht. -
% m regexp
RET, * % regexpRET - Mark (with
*) all files whose names match the regular expression regexp (dired-mark-files-regexp). This command is like% d, except that it marks files with*instead of flagging withD. Only the non-directory part of the file name is used in matching. Use^and$to anchor matches. You can exclude subdirectories by temporarily hiding them (Hiding Subdirectories). -
% g regexp
RET - Mark (with
*) all files whose contents contain a match for the regular expression regexp (dired-mark-files-containing-regexp). This command is like% m, except that it searches the file contents instead of the file name. Note that if a file is visited in an Emacs buffer, anddired-always-read-filesystemisnil(the default), this command will look in the buffer without revisiting the file, so the results might be inconsistent with the file on disk if its contents have changed since it was last visited. If you don't want this, you may wish to revert the files you have visited in your buffers, or to turn on Auto-Revert mode in those buffers, before invoking this command. Reverting. If you prefer that this command should always revisit the file, without you having to revert the file or enable Auto-Revert mode, you might want to setdired-always-read-filesystemto non-nil. - C-/, C-x u, C-_
- Undo changes in the Dired buffer, such as adding or removing marks (
dired-undo). This command does not revert the actual file operations It just undoes changes in the buffer itself. In some cases, using this after commands that operate on files can cause trouble. For example, after renaming one or more files,dired-undorestores the original names in the Dired buffer, which gets the Dired buffer out of sync with the actual contents of the directory. - touchscreen-hold
- Enter a ``click to select'' mode, where using the mouse button
mouse-2on a file name will cause its mark to be toggled. This mode is useful when performing file management using a touch screen device. It is enabled when a ``hold'' gesture (Touchscreens) is detected over a file name, and is automatically disabled once a Dired command operates on the marked files.