Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a cron job for creating a gzip file:

mysqldump... | gzip -c > myfile..sql.gz

I want myfile to be of the format "time_date.sql.gz"

How do I create file with the current date and time?

Thanks

share|improve this question
up vote 7 down vote accepted
myfile_`date '+%F_%T'`.sql.gz
share|improve this answer
    
thanks......... – Am. Feb 8 '10 at 16:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.