Crates.io | uniqopy |
lib.rs | uniqopy |
version | 0.3.0 |
source | src |
created_at | 2022-01-10 05:35:31.96126 |
updated_at | 2022-02-06 18:51:20.953601 |
description | Create a copy of a file with a unique name (based on timestamp and MD5-hash). |
homepage | https://github.com/nathanielknight/uniqopy |
repository | https://github.com/nathanielknight/uniqopy |
max_upload_size | |
id | 511171 |
size | 15,205 |
Create a unique copy of a file using its name, the system time, and MD5 hashing.
$ ls
fibblesnork.txt
$ uniqopy fibblesnork.txt
Copying fibblesnork.txt to fibblesnork.2022-01-10-07:06:49.db194cb65e3d5200798471729c8f3e9a.txt
Copyied 16 bytes
$ ls
fibblesnork.2022-01-10-07:06:49.db194cb65e3d5200798471729c8f3e9a.txt
fibblesnork.txt
You might want a unique filename:
For files generated in a batch job
For (small) backups
For log rotation
Etc.
To generate a uniquely named copy, uniqopy:
std::fs::read
and the
md5
crate),chrono::offset::Local::now
),std::path::Path::extension
) it's moved to the end of the new filename.For example:
foo
becomes
foo.2022-01-10-07:05:03.d3b07384d113edec49eaa6238ad5ff00
foo.txt
becomes foo.2022-01-10-07:05:01.0e771a9094f21f0bf74be99ebdbb568d.txt
This work is provided under the Parity Public License 7.0.0 which can be
found in LICENSE.md
or at
https://paritylicense.com/versions/7.0.0.