Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

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
up vote 15 down vote accepted

By slipping the date command into the filename:

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

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
for date with time: zip -r "archive-$(date +"%Y-%m-%d %H-%M-%S").zip" file1 file2 file3 file4 – Delta7 Jul 20 at 10:21

Your Answer


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.