Replace text in many files

Find a piece of text in every text file under a folder, check each match, and replace only the ones you choose.

Change the same text in many files at once. MeiFiles shows every match first, and you choose which ones to replace.

The Find Files sheet, where you switch between Find and Find & Replace.

Preview the changes#

  1. Press ⌘F, or choose File > Find Files….
  2. At the top of the sheet, choose Find & Replace.
  3. Type the text to find in the Search… field.
  4. Type the new text in the Replace with… field.
  5. Click Preview Changes.

The list groups the matches by file. Each row shows the line number, the old text and the new text. The line below the list shows how many matches were found in how many files.

The search is plain text, not a regular expression. Case Sensitive and Hidden Files apply. MeiFiles skips files that are not UTF-8 text.

Choose which matches to replace#

  • Turn off the checkbox of a match to keep it as it is.
  • Click Select All or Deselect All to change every checkbox.

Replace the text#

  1. Leave Create backups (.bak) on to keep a copy of each file before it changes. The copy of notes.txt is notes.txt.bak.
  2. Click Replace Selected to replace the checked matches. Or click Replace All, then confirm, to replace every match.

A message shows how many matches were replaced.

Caution: You cannot undo a replacement with Undo File Operation. Keep Create backups (.bak) on if you might need the old text.

When a file is left unchanged#

MeiFiles does not change a file in these cases, and lists it with the reason:

  • The file changed after the preview.
  • The file could not be read, or it is not UTF-8 text.
  • The backup could not be made.

Click Preview Changes again to see the current matches.

See also#

Search MeiFiles guide

Search the user guide.