30.4 Flagging Many Files at Once
The #, ~, ., % &, and % d commands
flag many files for deletion, based on their file names:
#
Flag all auto-save files (files whose names start and end with ‘ #’)
for deletion (see Auto-Saving: Protection Against Disasters).
~
Flag all backup files (files whose names end with ‘ ~’) for deletion
(see Backup Files).
. (Period)
Flag excess numeric backup files for deletion. The oldest and newest few backup files of any one file are exempt; the middle ones are flagged.
% &
Flag for deletion all files with certain kinds of names which suggest you could easily create those files again.
% d regexp RET
Flag for deletion all files whose names match the regular expression regexp.
# ( dired-flag-auto-save-files) flags all files whose
names look like auto-save files—that is, files whose names begin and
end with ‘ #’. See Auto-Saving: Protection Against Disasters.
~ ( dired-flag-backup-files) flags all files whose names
say they are backup files—that is, files whose names end in
‘ ~’. See Backup Files.
. (period, dired-clean-directory) flags just some of
the backup files for deletion: all but the oldest few and newest few
backups of any one file. Normally, the number of newest versions kept
for each file is given by the variable dired-kept-versions
( not kept-new-versions; that applies only when saving).
The number of oldest versions to keep is given by the variable
kept-old-versions.
Period with a positive numeric argument, as in C-u 3 .,
specifies the number of newest versions to keep, overriding
dired-kept-versions. A negative numeric argument overrides
kept-old-versions, using minus the value of the argument to
specify the number of oldest versions of each file to keep.
% & ( dired-flag-garbage-files) flags files whose names
match the regular expression specified by the variable
dired-garbage-files-regexp. By default, this matches certain
files produced by TeX, ‘ .bak’ files, and the ‘ .orig’ and
‘ .rej’ files produced by patch.
% d flags all files whose names match a specified regular
expression ( dired-flag-files-regexp). Only the non-directory
part of the file name is used in matching. You can use ‘ ^’ and
‘ $’ to anchor matches. You can exclude certain subdirectories
from marking by hiding them while you use % d. See Hiding Subdirectories.