Batch text replacement powered by dictionaries. Replace keys with values or values with keys across entire directories.
pip install textswap
Replace keys with values or values with keys. Perfect for encoding/decoding or reversible transformations.
Define multiple replacement dictionaries in one config file and switch between them easily.
Skip files by extension, prefix, or entire directories. Never accidentally modify binaries or dependencies.
Process entire directories at once. Recursively replace text across all matching files.
Simple JSON config file for dictionaries and ignore patterns. Easy to version control.
If only one dictionary exists, it's automatically selected. No extra prompts needed.
{
"dictionaries": {
"obfuscate": {
"password": "p4ssw0rd",
"admin": "4dm1n",
"secret": "s3cr3t"
}
},
"ignore_extensions": [".exe", ".dll", ".bin"],
"ignore_directories": ["node_modules", "venv", ".git"],
"ignore_file_prefixes": [".", "_"]
}
# Interactive mode
$ textswap
# With options
$ textswap -f ./src -d 1 -c config.json
# Dry run (preview changes)
$ textswap -f ./src -d 1 --dry-run