You picked a sensible filename. The folder already has it.
You export a report, pull down the same attachment again, or spin up another backup folder. The name you want is taken. You either overwrite something you needed, or you hand-roll a loop that checks exists, bumps a counter, and hopes nothing else writes in the same millisecond.
Unused Path is the small Python helper that picks the next unused path for you.
Like the browser naming your second download, without the while loop.
What you get
- The next free name, not a overwrite. When the path you want is taken, you get a sibling with an incrementing numeric suffix in the familiar parenthesis style.
- Folders, not only files. The same idea works when you need a fresh directory name for backups or batch exports.
- Your own numbering style when you need it. Plug in a formatter for underscore versions, zero-padded versions, or any pattern you define.
- A calmer concurrent story. Optional atomic creation can claim an empty file or directory while several workers race for a name.
- No extra packages to install. The library ships with zero third-party dependencies.
- Free and open source. MIT licensed, on PyPI and GitHub.
Picture your Tuesday export
You run a nightly job that drops a CSV next to yesterday's file. The first night it uses the plain name. The next night the folder already holds that file, so the job asks for an unused path and writes report (1).csv instead of stomping the old one. Same script, no manual rename dance.






