Chapter 15
Search and replace across a folder
Search#
- Open the folder.
- Choose the Search sidebar (⇧⌘F by default).
- Choose Folder scope.
- Enter the search term and optional Match Case, Whole Word, or Regular Expression controls.
- Open a result to inspect it in context.
Replace transactionally#
- Choose Replace… beside the result count.
- Enter the replacement.
- Review each affected file, match count, and before/after sample.
- Deselect files that should remain unchanged.
- Confirm the final match and file count.
Pilcrow skips open files, non-UTF-8 text, and files changed after the preview. This prevents a folder operation from silently overwriting newer work. A replacement affects at most 2,000 files at a time.
Afterward, use the replacement window’s Undo banner to restore the latest batch. A file edited since replacement is left alone. Only the most recent folder replacement has this special backup, so validate before starting another.