I'm trying to make a script that I'd add to cron that would pack some files in an archive file and prifix the curent date to the filename.
Curently this is how it's setup:
But I still don't know how to make the archive into a zip file and how to prifix the date into the filename. Something like /home/user/archive/26-11-2006_filename.zip .
tar -c /home/user/archive/filename.tgz /home/user/folder/*.gif /home/user/folder/*.jpg /home/user/folder/*.png
Thanks for the help
This information is all available in the man pages for tar and date.
[hector@troy ~]$ date +%d-%m-%Y
Finally, you can simply mv the filename such that it's prefixed with the date. Example: BACKUP1=/some/file1
[hector@troy ~]$ tar czf backup somefile1
[hector@troy ~]$ file backup
backup: gzip compressed data ...
mv "$BACKUP1" "$DATE1"_"$BACKUP1"
Cool, thank you >anomie< it works great.