Here are commands that alter file names in a systematic way:
dired-upcase
). If the old file names are `Foo'
and `bar', the new names are `FOO' and `BAR'.
dired-downcase
). If the old file names are `Foo' and
`bar', the new names are `foo' and `bar'.
The four regular-expression substitution commands effectively perform a search-and-replace on the selected file names in the Dired buffer. They read two arguments: a regular expression from, and a substitution pattern to.
The commands match each "old" file name against the regular
expression from, and then replace the matching part with to.
You can use `\&' and `\digit' in to to refer to
all or part of what the pattern matched in the old file name, as in
replace-regexp
(see section Regexp Replacement). If the regular expression
matches more than once in a file name, only the first match is replaced.
For example, % R ^.*$ RET x-\& RET renames each selected file by prepending `x-' to its name. The inverse of this, removing `x-' from the front of each file name, is also possible: one method is % R ^x-\(.*\)$ RET \1 RET; another is % R ^x- RET RET. (Use `^' and `$' to anchor matches that should span the whole filename.)
Normally, the replacement process does not consider the files' directory names; it operates on the file name within the directory. If you specify a numeric argument of zero, then replacement affects the entire absolute file name including directory name.
Often you will want to select the set of files to operate on using the same regexp that you will use to operate on them. To do this, mark those files with % m regexp RET, then use the same regular expression in the command to operate on the files. To make this easier, the % commands to operate on files use the last regular expression specified in any % command as a default.
Go to the first, previous, next, last section, table of contents.