Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

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.

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


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.