4

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.

user2354329
  • 670
  • 4
  • 11
ironsand
  • 5,085
  • 12
  • 50
  • 73

3 Answers3

9

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.

phemmer
  • 70,657
  • 19
  • 188
  • 223
6

Try:

zip foo.zip -- -foo

Simply put -- before the filename(s).

v154c1
  • 1,156
  • 7
  • 6
6

Try using --

For example:

zip foo.zip -- -folder
mulaz
  • 2,457
  • 1
  • 14
  • 8