Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to zip only selected directories(and its child directories as well)

I have many directories in the current folder like app, content, db, library etc.

But I would like the zip only app and content and its child folders. I am trying the following.

zip -r ../backups/code/20110625 -i app/* -i content/* . *

But I am getting the following error.

zip error: Invalid command arguments (nothing to select from)

What is the correct syntax to achieve this?

share|improve this question
add comment

1 Answer 1

up vote 9 down vote accepted

Try:

zip -r myzipfile.zip ../backups/code/20110625 app/* content/* . *

You need to put the name of the zipfile first.

share|improve this answer
    
Thanks. I need to remove the leading slash from app and content to make it work. –  emaillenin Jun 25 '11 at 10:25
    
@emaillenin No probs. I made the change, even though it is context specific. Will you accept the answer please? Glad it worked for you. –  slotishtype Jun 25 '11 at 10:28
add comment

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.