unique
A small but practical command-line utility for creating safe, unique file and directory names.
When scripts, backups, content pipelines, or file-based workflows need to create or rename paths
without collisions, unique appends a timestamp-, UUID-, or entropy-based suffix to keep names
distinct, readable, and easy to trace.
Why use unique?
File naming collisions are a recurring problem in scripting, automation, backups, content pipelines,
and content authoring workflows. unique gives you a simple interface to:
- create a new file or directory with a guaranteed unique name
- rename an existing path to have a unique name
- duplicate a file while preserving its original contents under a fresh name
- choose the suffix generation method that best fits your workflow
Features
- Create files or directories with unique names
- Rename existing files or folders safely
- Duplicate files with a unique derivative name
- Multiple suffix strategies:
datetimeepochuuiduuid7uuid-b36uuid7-b36
- Python-based CLI design for simple automation and scripting
Documentation
- Build from Source — set up the project and produce a distributable build.
- Using unique — learn the CLI commands and examples.
Installation
Prerequisites
- Python 3
pip
Set up a virtual environment
python3 -m venv .venv
source .venv/bin/activate
Install dependencies
pip install "git+https://rprime.indroneel.co/termhole/scott.git"
pip install uuid6
Install the project
pip install -e .
You can then invoke the CLI as:
unique --help
Usage
The CLI is organized around a small set of commands.
Create a unique file
unique create --file notes.txt
Example result:
notes-20260916-153425.txt
Create a unique directory
unique create --dir project
Example result:
project-20260916-153425
Rename an existing file or directory
unique touch report.md
This appends a generated suffix to the original path instead of overwriting an existing file.
Duplicate a file with a unique name
unique duplicate ./archive.tar.gz
Example result:
archive-20260916-153425.tar.gz
Suffix methods
You can control the suffix algorithm with the --method option:
unique create --file draft.txt --method uuid7
Available methods:
datetime— current date and timeepoch— Unix timestamp in millisecondsuuid— UUID v4uuid7— UUID v7uuid-b36— base36 UUID representationuuid7-b36— base36 UUID v7 representation
Command reference
unique create
Create a file or directory with a unique name.
unique create PATH --file|--dir [--method METHOD]
unique touch
Rename an existing file or directory to a unique variant.
unique touch PATH [--method METHOD]
unique duplicate
Create a copy of an existing file with a unique name.
unique duplicate PATH [--method METHOD]
Examples
# Create a unique file using a UUID v7 suffix
unique create --file draft.md --method uuid7
# Create a unique directory using the current timestamp
unique create --dir content --method datetime
# Rename an existing file to a unique version
unique touch ./notes.txt --method epoch
# Duplicate a file without clobbering the original
unique duplicate ./backup.db --method uuid-b36
Project layout
unique/
├── LICENSE
├── README.md
├── pyproject.toml
├── unique.spec
├── src/
│ └── unique/
│ ├── commands/
│ ├── lib/
│ └── main.py
└── .venv/
License
This project is licensed under the terms of the repository license. See LICENSE for details.
Notes
This project is intentionally compact and script-friendly: it focuses on one task well—creating unique names for paths—while leaving room for automation in shell scripts, build tooling, and content workflows.
If you want to package it into a standalone executable, the repository includes a PyInstaller spec file at unique.spec.