Skip to main content

iname — Internet Name

CI PyPI Python License: MIT

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: --verbose prints old → new mappings (doesn't interfere with pipes)
  • -0 / --null: NUL-separated paths on stdin and stdout, for find -print0 and xargs -0
  • Directories: renamed like files; rename children before parents (find -depth)
  • Collisions: auto-dedup with -01, -02, ... -99 suffix
  • 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

Requires Poetry.

poetry install
poetry run pytest --cov=iname --cov-report=term-missing
poetry run ruff check .

Origin

Extracted from xplat — the proven rename logic, distilled into a single-purpose Unix tool.

Metadata

Release files for iname 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iname 0.2.1
File Size Uploaded Provenance Actions
iname-0.2.1.tar.gz 7.3 kB With provenance Details for iname-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iname 0.2.1
File Interpreter ABI Platform Actions
iname-0.2.1-py3-none-any.whl Python 3 none any Details for iname-0.2.1-py3-none-any.whl

Total release size: 16.2 kB

Release files / iname-0.2.1.tar.gz

Download URL iname-0.2.1.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
87ff0c70f1316c139e04fa480c9f9ec4f82bb4ea6d0e86594ec58c7270b8372e
BLAKE2b-256 checksum
How to use checksums
3ea5dcdc7618ccb6d4e9a561905566b834409000fddc33be96d234557bf6a0a9
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 log

Release files / iname-0.2.1-py3-none-any.whl

Download URL iname-0.2.1-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d6a91ed15144aa50f91a99f481a85ed3d0fad743427271213a7998985522978
BLAKE2b-256 checksum
How to use checksums
26d993be9f8da4e57cde2e4178ba15c5010a9b02f038ee172e5638bffe8b91f5
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 log

Security for iname 0.2.1

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.

Select from 2 files

Attestation for iname-0.2.1.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 log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page