This can easily be done using
- Enter a dired view of your directory
- Switch to writable dired mode (
- Edit the file names listing as if it were a normal buffer (for example using a keyboard macro or a rectangular selection or query-replace). Here is a regexp-based solution:
- Finish editing (
wdired-finish-edit): C-xC-s or C-cC-c
Emacs: Rename Files Interactively
This pages shows you how to rename multiple files in emacs.
Go to the directory first, by calling
dired. 〔➤ Emacs: File Management (dired tutorial)〕
When in dired, call
dired-toggle-read-only 【Ctrl+x Ctrl+q】.
Then, just edit the file names.
When done, do one of:
wdired-finish-edit 【Ctrl+c Ctrl+c】 to commit the changes.
wdired-abort-changes 【Ctrl+c Ctrl+k】 to abort the changes.
From the documentation:
dired-dwim-target is a variable defined in `dired.el’. Its value is nil
Documentation: If non-nil, Dired tries to guess a default target directory. This means: if there is a Dired buffer displayed in the next window, use its current directory, instead of this Dired buffer’s current directory.
The target is used in the prompt for file copy, rename etc.
Put this in your init file:
(setq dired-dwim-target t). Then, go to dired, split your window,
split-window-vertically & go to another dired directory. When you will press C to copy, the other dir in the split pane will be default destination.