iname — Internet Name
Make file and directory names safe and consistent for the web. One path at a time, composable with Unix pipes.
Install
pip install iname
Usage
# 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
# Filenames with newlines or other odd characters: NUL-separated in and out
find . -name "*.jpeg" -print0 | iname -0 | xargs -0 ls -la
# Directories too (-depth renames children before their parents)
find . -depth -type d | iname
# Chain with other tools
iname "My Photo.jpeg" | xargs ls -la
# Preview a batch
find . -name "*.JPEG" | iname --dry-run --verbose
Styles
| 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 |
Dots are kept in every style, so archive.tar.gz, example.com.zip and
app.min.js are left alone and My Photo.v2.JPG becomes my-photo.v2.jpg.
A dot outranks the separators next to it: My Photo .v2 → my-photo.v2.
The extension is kept verbatim apart from lowercasing (photo.C++ → photo.c++),
unless it contains whitespace, in which case the whole name is sanitized.
Behavior
- Stdout: always prints the new path (enables piping and chaining)
- Stderr:
--verboseprintsold → newmappings (doesn't interfere with pipes) -0/--null: NUL-separated paths on stdin and stdout, forfind -print0andxargs -0- Directories: renamed like files; rename children before parents (
find -depth) - Collisions: auto-dedup with
-01,-02, ...-99suffix - Already safe: prints path unchanged, exits 0
- Exit codes: 0 = success, 1 = error, 2 = usage error
Safety
- Rejects symlinks, and refuses to rename
.or.. - Never overwrites: files are moved with an atomic hard link, so a target that appears between the collision check and the move is reported, not clobbered (directories and filesystems without hard links fall back to a plain rename)
- Strips null bytes
- Normalizes Unicode whitespace (no-break spaces, narrow spaces)
- Folds accented letters to ASCII (
Café.png→cafe.png), so a name comes out the same whether the filesystem stores it as NFC (Linux) or NFD (macOS) - Sanitizes an extension containing whitespace:
photo.JPG (1)→photo.jpg-1 - Keeps hidden files hidden (
.DS_Store→.ds_store) - Truncates to filesystem NAME_MAX (255 bytes), including any dedup suffix
- Case-insensitive filesystem aware
Zero dependencies
iname uses only the Python standard library. No runtime dependencies.
Development
pip install -e '.[dev]'
pytest --cov=iname --cov-report=term-missing
Origin
Extracted from xplat — the proven rename logic, distilled into a single-purpose Unix tool.
Metadata
Release files for iname 0.2.0
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 |
|---|---|---|---|---|
| iname-0.2.0.tar.gz | 13.2 kB | With provenance | Details for iname-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iname-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for iname-0.2.0-py3-none-any.whl |
Total release size: 22.4 kB
Release files / iname-0.2.0.tar.gz
| Download URL | iname-0.2.0.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e474a92183eee904838df48d27f515772cb74c27836d24344c9f81f6bf4768c
|
|
BLAKE2b-256 checksum How to use checksums |
40c6aebdddef094bb1bcfeb3f01cf093d0efcfaad6ac18257800e10e82a465d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / iname-0.2.0-py3-none-any.whl
| Download URL | iname-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
53ccde623f0279add9567b27c3b1e6762a05b489fd585386cabf7a582869bc32
|
|
BLAKE2b-256 checksum How to use checksums |
a1cdbdf10158a9b8c4109261c938bfdf05ac133820157035c7eac6ea942a7e20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logSecurity for iname 0.2.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for iname-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logA 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.