Tuesday, March 23, 2021

Find and replace across multiple files in Emacs, Rename multiple files in Emacs

 Find and replace across lots of files in emacs:

  1. M-x find-name-dired: prompts for a root directory and a filename pattern.

  2. Use t to "toggle mark" for all files found.

  3. Use Q for "Query-Replace in Files...": prompts for query/substitution regexps.

  4. Proceed with query-replace-regexp: SPACE to replace and move to next match, n to skip a match, etc.

  5. Press C-x s to save buffers. (then use y, n or ! to save all at once)

To rename multiple files in emacs:

  1. Alt+x dired to go to the directory.

  2. Alt+x dired-toggle-read-only 【C-x C-q】.

  3. Then, just edit the file names.

  4. When done, wdired-finish-edit 【C-c C-c】 to commit the changes.

No comments:

Post a Comment