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.


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.

| improve this answer | |


zip foo.zip -- -foo

Simply put -- before the filename(s).

| improve this answer | |

Try using --

For example:

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

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