Unused Path

Generate unused file and directory paths by auto-incrementing numeric suffixes

Gallery image 1

Unused Path

Pick non-colliding file or folder names with browser-style numeric suffixes

unused-path is a dependency-free Python library that suggests unused_filename and unused_directory paths by appending incrementing numeric suffixes (for example report (1).pdf) when the target already exists. It supports custom formatters, optional atomic create=True to reduce races in concurrent workers, max_tries, and full type hints, as documented in the GitHub / PyPI package page.

When it is useful

You export downloads, backups, logs, or CSVs and need safe names without overwriting prior runs. It fits scripts, CLIs, and services that may write from multiple workers at once.

What you can do

  • Resolve a unique path next to an existing name, continuing the sequence if numbered siblings are already present.
  • Turn on atomic creation when you want the library to create the empty file or directory as part of claiming the name.
  • Plug in a formatter for styles like zero-padded versions or underscore numbering.

Limits

  • Uniqueness is filesystem-level at generation time; another process could still race you unless you use create=True appropriately.
  • Extremely dense directories could hit max_tries; handle RuntimeError from the API contract.
  • It does not manage retention, quotas, or cloud object-store semantics; only path naming.

You might also like

Explore All Blogs