semvec/pypi-packages huggingface dataset:
incname 1.0.0
Increment file/directory name if it exists
Requires Python: >=3.6

# incname

This Python package provides the function `incname(path)` to increment file/directory name if it exists.

## Usage

Pass your `path` to the function `inсname(path)`, and it will return an incremented path if the initial one already exists. Otherwise `path` will be returned.

For example, let us say that you need to write to `C:\new.txt` not overwriting the file if it already exists. Then `inсname(r'C:\new.txt')` will give you `C:\new.txt` if it does not exist and `C:\new.1.txt` if `C:\new.txt` already exists. The next function calls will give you `C:\new.2.txt`, `C:\new.3.txt`, etc.

You can pass the additional options to the function:

* `start` is the first counter value (`start=1` by default),

* `zfill` is the argument of `str.zfill()` to fill the increment value with padding zeros (`zfill=1` by default),

* `sep` is the separator between the filename and the increment value (`sep='.' by default`).

## Changelog

* Version 1.0.0 (2021-07-26): initial release

----------

**incname**

Version 1.0.0 (2021-07-26)

Copyright (c) 2021 Evgenii Shirokov

MIT License