38.16 Editing the Dired Buffer
Wdired is a special mode that allows you to perform file operations
by editing the Dired buffer directly (the “W” in “Wdired” stands
for “writable”.) To enter Wdired mode, type M-x
wdired-change-to-wdired-mode while in a Dired buffer. Alternatively,
use ‘Edit File Names’ in the ‘Immediate’ menu bar menu.
While in Wdired mode, you can rename files by editing the file names
displayed in the Dired buffer. All the ordinary Emacs editing
commands, including rectangle operations and query-replace
, are
available for this. Once you are done editing, type C-c C-c
(wdired-finish-edit
). This applies your changes and switches
back to ordinary Dired mode.
Apart from simply renaming files, you can move a file to another
directory by typing in the new file name (either absolute or
relative). To mark a file for deletion, delete the entire filename.
To change the target of a symbolic link, just edit the target name
displayed next to the link name.
The rest of the text in the buffer, such as the file sizes and
modification dates, is marked read-only, so you can't edit it.
However, if you set wdired-allow-to-change-permissions
to
t
, the file permission bits can also be edited. For example,
you can change ‘-rw-r--r--’ to ‘-rw-rw-rw-’ to make a file
world-writable. These changes also take effect when you type C-c
C-c.