filename.get_unique_filename

convert.filename.get_unique_filename(path)

Generate unique path by adding “_n” before the file extension, if needed.

If the given path already exists, this function appends an incrementing number before the file extension (e.g., “file_1.py”) until an unused filename is found.

Parameters

Name Type Description Default
path str | Path The initial file path to check. required

Returns

Name Type Description
Path A unique file path that does not currently exist.