To zip directory foo but exclude sub directories bar and baz. zip -r myarchive.zip foo -x "foo/bar/*" "foo/baz/*"