The command for doing this is quite simple. To just create a file with a time stamped file name, use the following command:
touch myfile-$(date '+%Y-%m-%d-%T')
The command will produce a file called myfile-2009-02-25-17:32:01 You can also use it to make backups when combined with tar. The following code will create a date stamped gzipped tar file of a directory called test.
tar czvf test_backup_$(date '+%Y%m%d').tgz test/
Using the above commands with cron can allow you to quickly create a very simple, yet effective, backup system for any important folders that you need to archive.
0 comments:
Post a Comment