Click to See Complete Forum and Search --> : Script to copy files


MarkLeong
12-08-2001, 12:02 AM
I want to run a cron job that will copy a file. However the copied file need to have a time and date stamp as part of the filename. The copied file has to look like:-

originalfilename.yyyymmdd.hhmmss.backup

How do I capture the computer's date and time and append it to the filename?

error27
12-08-2001, 12:48 AM
cp foo foo$(date +%Y%m%d.%k%M%S).backup

man date for more details.