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 up the contents (excluding hidden files and folders) of the folder I am currently in?

zip -r extension.xpi . -x "*/.*"

This is what I have so far, but I am still getting hidden files.

share|improve this question
Do you mean hidden files in subfolders? Otherwise it's just * which by default does not include hidden files. – frostschutz Feb 20 '13 at 0:49
up vote 2 down vote accepted

your */.* will only include hidden files in subdirectories. but not in your current directory or subdirectories of subdirectories. try this zip -r extension.xpi . -x ".*" or that zip -r extension.xpi . -x .\*.

I guess the backslash should be the key, thats a quote from the manpage:

Explicitly exclude the specified files, as in:

zip -r foo foo -x \*.o

which will include the contents of foo in foo.zip while excluding all the files that end in .o. The backslash avoids the shell filename substitution, so that the name matching is performed by zip at all directory levels.

share|improve this answer

Your Answer


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.