Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I zip a directory like -foo? $ zip "-foo" "-foo" shows only help page.

I think -foo is recognized as a options, but I don't know how to solve it.

share|improve this question

marked as duplicate by slm, Anthon, jasonwryan, terdon, manatwork Oct 10 '13 at 8:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers 3

up vote 9 down vote accepted

The general way for doing things like this is to prefix the file name with ./.

zip foo.zip ./-foo

This technique works most other utilities which accept a file name as an argument.

share|improve this answer

Try:

zip foo.zip -- -foo

Simply put -- before the filename(s).

share|improve this answer

Try using --

For example:

zip foo.zip -- -folder
share|improve this answer

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