Floog
10-12-2003, 05:02 PM
I've made a very simple bash script that I named archive.sh
What I would like to do is use some of the "date" command output to name create and name a new sub-directory where all the newly created .tar.bz2 files will be stored.
Basically, my script takes different directories and tars and bzips the data.
Example:
tar -cjpf /archive/foo1.tar.bz2 /home/foo1
tar -cjpf /archive/foo2.tar.bz2 /home/foo2
Once the script completes all the tar files, I would like to somehow run the "date" command, take some of the output and use that output to create a new sub-directory of /archive
Example:
~$date
Sun Oct 12 17:00:06 EDT 2003
I'd like to take the "Oct 12 . . . 2003" and create a subdirectory called /archive/Oct_12_2003
Then, I'd do a simple move command, moving all the recently created *.tar.bz2 files into the /archive/Oct_12_2003 directory
So, every time I run my archive.sh script it would just create a new archive subdirectory with an easily identifiable date name.
I just don't know how to parse the "date" output and use it to create a new sub-directory.
Can anyone point me in the right direction to get started. Thanks for your time and patience.
Floog
What I would like to do is use some of the "date" command output to name create and name a new sub-directory where all the newly created .tar.bz2 files will be stored.
Basically, my script takes different directories and tars and bzips the data.
Example:
tar -cjpf /archive/foo1.tar.bz2 /home/foo1
tar -cjpf /archive/foo2.tar.bz2 /home/foo2
Once the script completes all the tar files, I would like to somehow run the "date" command, take some of the output and use that output to create a new sub-directory of /archive
Example:
~$date
Sun Oct 12 17:00:06 EDT 2003
I'd like to take the "Oct 12 . . . 2003" and create a subdirectory called /archive/Oct_12_2003
Then, I'd do a simple move command, moving all the recently created *.tar.bz2 files into the /archive/Oct_12_2003 directory
So, every time I run my archive.sh script it would just create a new archive subdirectory with an easily identifiable date name.
I just don't know how to parse the "date" output and use it to create a new sub-directory.
Can anyone point me in the right direction to get started. Thanks for your time and patience.
Floog