Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Recursively find and replace in file names and contents.

Project description

usage: pyreplace [-h] [-d DIRECTORY] [-r] [-v] [-g EXPRESSION]
[-f FIND REPLACE] [-fi] [-c FIND REPLACE] [-ci]

Recursively find and replace in file names and contents.

optional arguments:
-h, --help show this help message and exit
-d DIRECTORY, --directory DIRECTORY
Set starting directory.
-r, --dry-run Dont make any changes, just list what would happen.
-v, --verbose Display changes made.
-g EXPRESSION, --glob EXPRESSION
Find files with matching extension. Example: *.txt
-f FIND REPLACE, --filename FIND REPLACE
Search filename for FIND and replace with REPLACE.
-fi, --filename-insensitive
Ignore capital/lowercase when searching filename.
-c FIND REPLACE, --contents FIND REPLACE
Search contents for FIND and replace with REPLACE.
-ci, --contents-insensitive
Ignore capital/lowercase when searching contents.

Usage Examples:
Replace foo with bar in filenames matching *.txt:
pyreplace -g *.txt -f foo bar

Find and replace foo with bar in files matching *.txt (Contents):
pyreplace -g *.txt -c foo bar

As above with all files in current directory:
pyreplace -c foo bar

As above with all files in another directory:
pyreplace -d /home/foo -c foo bar

Project details


Release history Release notifications

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyreplace, version 1.0
Filename, size File type Python version Upload date Hashes
Filename, size pyreplace-1.0-py3.2.egg (5.2 kB) File type Egg Python version 3.2 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page