Go to file
Kevin Veen-Birkenbach c7bf51941b Optimized string replace to catch utf8 errors 2024-01-02 21:22:26 +01:00
LICENSE Initial commit 2023-08-22 22:21:44 +02:00
README.md Implemented multiple paths 2023-11-17 12:06:33 +01:00
replace_string.py Optimized string replace to catch utf8 errors 2024-01-02 21:22:26 +01:00


Bulk String Replacer

bulk-string-replacer is a Python-based command-line utility that allows for comprehensive search and replacement operations within file and folder names, as well as within file contents across specified directories. It's designed to handle bulk updates quickly and efficiently, with support for recursive directory traversal, hidden files, and a preview mode to review changes before they're applied.


Kevin Veen-Birkenbach


Learn more about the development and use cases of this tool in the original conversation with the developer.

Getting Started


  • Python 3.x
  • Access to a command-line interface


Clone the repository to your local machine:

git clone https://github.com/kevinveenbirkenbach/bulk-string-replacer.git

Change into the project directory:

cd bulk-string-replacer


Run the script with Python, specifying your target paths, the string to be replaced, and the new string:

python replace_string.py old_string --new-string new_string_value --options paths...


  • old_string: The string you want to search for and replace.
  • --new-string: The string that will replace old_string. Defaults to an empty string if not specified.
  • --recursive: Recursively process all subdirectories and files within the given paths.
  • --folder: Replace string occurrences within folder names.
  • --files: Replace string occurrences within file names.
  • --content: Replace string occurrences within the contents of the files.
  • --preview: Preview changes without applying them. No files will be modified.
  • --verbose: Output detailed information during the execution of the script.
  • --hidden: Include hidden files and directories in the operation.

Paths are specified at the end of the command, separated by spaces. For example:

python replace_string.py "search_string" --new-string "replacement_string" --recursive --verbose /path/to/first/directory /path/to/second/directory

Replace /path/to/first/directory and /path/to/second/directory with the actual paths you want to process.


Contributions are welcome! Please feel free to submit a pull request or open an issue on the GitHub repository.


This project is open-sourced under the GNU Affero General Public License v3.0. See the LICENSE file for more details.