97 lines
3.8 KiB
Markdown
97 lines
3.8 KiB
Markdown
---
|
|
title: Unique - Usage
|
|
---
|
|
|
|
# Using Unique
|
|
|
|
`Unique` is organized around a small set of commands. You can get a list of available commands by
|
|
invoking `unique` with help option.
|
|
|
|
```sh
|
|
$ ./unique -h
|
|
|
|
usage: unique [-h] {install,create,touch,retouch,duplicate} ...
|
|
|
|
Append a suffix to files and folders to ensure unique names
|
|
|
|
positional arguments:
|
|
{install,create,touch,retouch,duplicate}
|
|
install installs unique so that it can be used from the command line
|
|
create Create a new file or directory with a unique name
|
|
touch appends a prefix to the original file name to create a unique name
|
|
retouch
|
|
duplicate Creates an exact copy of a file, preserving its contents, but with an unique name
|
|
|
|
options:
|
|
-h, --help show this help message and exit
|
|
```
|
|
|
|
## create
|
|
|
|
```sh
|
|
$ ./unique create -h
|
|
usage: unique create [-h] (-f | -d) [-m METHOD] PATH
|
|
|
|
positional arguments:
|
|
PATH The path to the file or directory to be created with a unique name
|
|
|
|
options:
|
|
-h, --help show this help message and exit
|
|
-f, --file Indicates that the target is a file
|
|
-d, --dir Indicates that the target is a folder
|
|
-m METHOD, --method METHOD
|
|
Select the method to generate the suffix:
|
|
'datetime' : Use the current date and time as a unique suffix
|
|
'epoch' : Use the timestamp (milliseconds since epoch) as a unique suffix
|
|
'uuid' : Use the v4 universally unique identifier as a unique suffix
|
|
'uuid7' : Use the v7 universally unique identifier as a unique suffix
|
|
'uuid-b36' : Use the base36 representation of a UUID as a unique suffix
|
|
'uuid7-b36' : Use the base36 representation of a UUID7 as a unique suffix
|
|
Default is 'datetime'.
|
|
```
|
|
|
|
## touch
|
|
|
|
```sh
|
|
$ ./unique touch -h
|
|
usage: unique touch [-h] [-m METHOD] PATH
|
|
|
|
positional arguments:
|
|
PATH The path to the file or directory that needs a unique name
|
|
|
|
options:
|
|
-h, --help show this help message and exit
|
|
-m METHOD, --method METHOD
|
|
Select the method to generate the suffix:
|
|
'datetime' : Use the current date and time as a unique suffix
|
|
'epoch' : Use the timestamp (milliseconds since epoch) as a unique suffix
|
|
'uuid' : Use the v4 universally unique identifier as a unique suffix
|
|
'uuid7' : Use the v7 universally unique identifier as a unique suffix
|
|
'uuid-b36' : Use the base36 representation of a UUID as a unique suffix
|
|
'uuid7-b36' : Use the base36 representation of a UUID7 as a unique suffix
|
|
Default is 'datetime'.
|
|
```
|
|
|
|
## duplicate
|
|
|
|
```sh
|
|
$ ./unique duplicate -h
|
|
usage: unique duplicate [-h] [-m METHOD] PATH
|
|
|
|
positional arguments:
|
|
PATH The path to the file or directory to be created with a unique name
|
|
|
|
options:
|
|
-h, --help show this help message and exit
|
|
-m METHOD, --method METHOD
|
|
Select the method to generate the suffix:
|
|
'datetime' : Use the current date and time as a unique suffix
|
|
'epoch' : Use the timestamp (milliseconds since epoch) as a unique suffix
|
|
'uuid' : Use the v4 universally unique identifier as a unique suffix
|
|
'uuid7' : Use the v7 universally unique identifier as a unique suffix
|
|
'uuid-b36' : Use the base36 representation of a UUID as a unique suffix
|
|
'uuid7-b36' : Use the base36 representation of a UUID7 as a unique suffix
|
|
Default is 'datetime'.
|
|
```
|
|
|