Find & replace literal strings across file trees
v1.1.0curl -fsSL https://raw.githubusercontent.com/pubino/findir/main/findir \ -o ~/.local/bin/findir && chmod +x ~/.local/bin/findir
Remove anytime with findir --self-remove
No regex surprises. findir uses fixed-string matching so every character in your search is matched exactly as-is — dots, brackets, dollar signs, and all.
$ findir "foo" "bar" ./src - football + bartball - config.foo_value = "foo" + config.bar_value = "bar"
Every occurrence of the literal text "foo" is replaced — nothing more, nothing less.
$ findir "price ($USD)" "cost (EUR)" ./docs - The price ($USD) is shown at checkout. + The cost (EUR) is shown at checkout.
Parentheses, dollar signs, dots — all matched literally. No backslash gymnastics.
findir "old_func" "new_func" ./src
findir -y "old_func" "new_func" ./src
findir -n "TODO" "DONE" ./project
findir --depth 2 -p "*.py" "os.path" "pathlib.Path" ./project
findir -I "error" "warning" ./logs
findir --summary "old_api" "new_api" ./src
findir -i "TODO" "DONE" ./docs
findir --restore .findir-backups/20260310-120000/manifest.txt
| Flag | Description |
|---|---|
| Arguments | |
-s, --search STRING |
Search string |
-r, --replace STRING |
Replace string |
-d, --directory DIR |
Target directory (default: .) |
| Modes | |
-n, --dry-run |
Preview only (no prompt to apply) |
-y, --yes |
Skip preview, apply changes immediately |
--summary |
List affected files only (no inline diffs) |
-i, --interactive |
Confirm each file before replacing |
| Filtering | |
-I, --ignore-case |
Case-insensitive search |
-p, --pattern PATTERN |
Only process files matching glob pattern |
--depth N |
Limit directory traversal depth |
| Backup & Restore | |
--backup-dir DIR |
Custom backup directory (default: .findir-backups) |
--restore FILE |
Restore from a backup manifest file |
--danger |
Skip backup creation |
| Output | |
--no-color |
Disable colored output |
-v, --verbose |
Increase verbosity |
-q, --quiet |
Suppress non-error output |
--debug |
Enable debug output |
| Meta | |
--self-update |
Update findir to latest version |
--self-remove |
Uninstall findir |
-V, --version |
Show version |
-h, --help |
Show help |
Run findir --help for full details.
file --mime-encoding) and .git directories.
grep -F — fixed-string matching, no regex interpretation.
Every character in your search term is treated literally.
quotemeta() for safe literal substitution.
No special characters are interpreted during replacement.
findir --restore and the manifest path shown in the summary.
findir performs destructive, in-place modifications to files. While it creates automatic backups by default, these backups are best-effort and should not be relied upon as your sole safety net.
Always maintain your own backups and use version control before running
bulk find-and-replace operations. Preview changes with the default
dry-run mode or -n before applying.
This software is provided "as is", without warranty of any kind, express or implied. The authors are not responsible for any data loss or damage resulting from its use. You are solely responsible for your data and backups.