Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

In the command-line, how can I create a zip file from a directory, whose name would be the current date?

I can use zip -r name dir, but how give it the date for a name?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

By slipping the date command into the filename:

zip "archive-$(date +"%Y-%m-%d").zip" file1 file2 file3

That just does year-month-day but you can use times, weeks, etc if that suits you more. You can read more about the substitution strings in man date.

share|improve this answer
    
great, than you :) –  szaman Feb 25 '13 at 13:38

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.