Make filenames safe and consistent for the web. One file at a time, composable with Unix pipes.
pip install iname# Rename a single file (default: web style with hyphens)
iname "My Photo (2).jpeg" # → my-photo-2.jpeg
# Preview without renaming
iname "My Photo (2).jpeg" --dry-run
# Different naming styles
iname "My Photo.jpeg" --style snake # → my_photo.jpeg
iname "My Photo.jpeg" --style kebab # → my-photo.jpeg
iname "My Photo.jpeg" --style camel # → myPhoto.jpeg
# Batch rename with find
find . -name "*.jpeg" | iname
# Chain with other tools
iname "My Photo.jpeg" | xargs ls -la
# Preview a batch
find . -name "*.JPEG" | iname --dry-run --verbose| Style | Input | Output |
|---|---|---|
web (default) |
My Photo (2).jpeg |
my-photo-2.jpeg |
snake |
My Photo (2).jpeg |
my_photo_2.jpeg |
kebab |
My_Photo (2).jpeg |
my-photo-2.jpeg |
camel |
My Photo (2).jpeg |
myPhoto2.jpeg |
- Stdout: always prints the new path (enables piping and chaining)
- Stderr:
--verboseprintsold → newmappings (doesn't interfere with pipes) - Collisions: auto-dedup with
-01,-02, ...-99suffix - Already safe: prints path unchanged, exits 0
- Exit codes: 0 = success, 1 = error, 2 = usage error
- Rejects symlinks
- Strips null bytes
- Normalizes Unicode whitespace (no-break spaces, narrow spaces)
- Truncates to filesystem NAME_MAX (255 bytes)
- Case-insensitive filesystem aware
iname uses only the Python standard library. No runtime dependencies.
pip install -e '.[dev]'
pytest --cov=iname --cov-report=term-missingExtracted from xplat — the proven rename logic, distilled into a single-purpose Unix tool.