[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Generating unique file names
From: |
matte |
Subject: |
Generating unique file names |
Date: |
Sun, 13 May 2007 16:06:08 -0400 |
User-agent: |
Thunderbird 2.0.0.0 (X11/20070326) |
I am doing a simple [1]backup Bash script that creates a backup archive of a
folder (or file) I am working on. I want to have snapshaps all saved to one
directory. To ensure unique name, I am currently appending the date and time
to "MyArcName_data_time." But this creates a long and ugly name. I'd like
either something cleaner like a unique number appended (based on total files
in directory), or some random temp filename generator function that I don't
yet know about.
The count would be sufficient, as each folder will always hold ONLY these
archives, and no hidden files.
Thus, my directory would be:
myArcName_1.tar.gz
myArcName_2.tar.gz
myArcName_3.tar.gz
...
iF there's some bash function for this, groovy. If not, i just need to know
how to count the directories from inside my script.
Thanks in advance
References
1. http://www.linuxforums.org/forum/
- Generating unique file names,
matte <=