I'm looking for a solution to how to perform a search and replace in all files in a directory using Emacs.
I've found the solution myself. Dired has builtin functionality to do that. See article Interactively Find and Replace String Patterns on Multiple Files for further details.
As mentioned in the other answer you'll want to use dired.
First mark the files via
You'll want to use the
If I had a number of files in a directory named the following:
And I wanted them renamed so they all were prefixed with chapter-01, I would input the following keystrokes.