Results 1 to 4 of 4
I am doing a simple 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 ...
- 05-13-2007 #1Just Joined!
- Join Date
- May 2007
- Posts
- 2
generating unique file names (bash)
I am doing a simple 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
- 05-13-2007 #2
- 05-14-2007 #3Just Joined!
- Join Date
- May 2007
- Posts
- 2
Doh!
Now why didn't that occur to me. Burn out is an ugly thing. Thanks!
- 05-14-2007 #4
I think you could also use....mktemp(thanks to coderoot
)
man mktemp
http://www.linuxforums.org/forum/lin...ile-names.html- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------


Reply With Quote
