detox
detox is a Python tool that can be used to rename directories/files with unsafe characters or spaces1.
Requirements
Installation
pip install -U detoxpy
Usage
usage: detox [-h] [-r] [-R REPLACE_WITH] [-t] [-l] [-n] [-p] path [path ...]
positional arguments:
path Path to a single or multiple files/directories to detox
optional arguments:
-h, --help show this help message and exit
-r, --recursive Rename files recursively
-R REPLACE_WITH, --replace-with REPLACE_WITH
Replace spaces and unsafe characters with this character (default: '_')
-t, --keep-trailing Keep the trailing character if exists (e.g., 'foo_')
-l, --keep-leading Keep the leading character if exists (e.g., '_foo')
-n, --dry-run Do a trial run with no permanent changes
-p, --plain-print Print the change as plain text
Examples
Example 1: Detox a single file/directory:
detox '(foo)^bar.txt'
# '(foo)^bar.txt' --> 'foo_bar.txt'
detox 'foo&bar/'
# 'foo&bar' --> 'foo_bar'
Example 2: Detox a directory recursively:
# foo bar
# └── foo1&foo2
# ├── foo bar (copy 1).jpg
# └── foo bar (copy 2).jpg
detox -r 'foo bar'
# foo_bar
# └── foo1_foo2
# ├── foo_bar_copy_1.jpg
# └── foo_bar_copy_2.jpg
Example 3: Duplicate names after detoxing
detoxwill avoid overwriting if the detoxed name already exists. For example:
tree 'foo foo'
# foo foo
# ├── foo^bar.jpg
# └── foo%bar.jpg
detox -r -i 'foo foo'
# foo_foo
# ├── foo_bar.jpg
# └── foo_bar-1.jpg
Metadata
Release files for detoxpy 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| detoxpy-0.1.5.tar.gz | 4.5 kB | Without provenance | Details for detoxpy-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| detoxpy-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for detoxpy-0.1.5-py3-none-any.whl |
Total release size: 10.4 kB
Release files / detoxpy-0.1.5.tar.gz
| Download URL | detoxpy-0.1.5.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
521972168842a1ccdd248ff450ac5dda05f8f0796a11a13bef22466613320445
|
|
BLAKE2b-256 checksum How to use checksums |
835df0a0a32f013d7a2c9990e7b2096081c3973acc6fca336d81384baed781e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.13.13 Darwin/25.5.0
|
Release files / detoxpy-0.1.5-py3-none-any.whl
| Download URL | detoxpy-0.1.5-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d2fdaf068c276d7cd3befd10dba2eff228ca32e2379d5d61c33db55a9b41f49
|
|
BLAKE2b-256 checksum How to use checksums |
1f9250b62513dbaead7ce0caced1f23decbe944489a44b59a65f66adb9ed36d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.13.13 Darwin/25.5.0
|
Security for detoxpy 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.