Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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 14 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

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.