I, need to zip a directory excluding some subdirectory and file; I used this:
zip -r zipfile.zip . -x ".*" -x "app/bower_components" -x "node_modules" -x "*.zip" -x "node_modules"
without any success; node_modules
is a folder in the principal one while bower_components
is inside the folder app
I simply make a guess what you want.
exclude all files beginning with a dot
do it like:
exclude all files (with a dot in the filename)
do it like:
--
exclude this directory and all files in it
do it like:
--
exclude all zip-Files
do it like:
You exclude node_modules twice
exclude all node_modules folders in all folders.
Assuming your directory is a git repository (and judging by the question, it very likely is), you can add directories that you want to exclude to the
.gitignore
file and use thegit archive
command to zip contents of your directory:In your example, the
.gitignore
file would have to look like this:Something like this should do the trick:
Where following
-x
is a list of directories and file (extension) types to exclude.This works perfect for me on Ubuntu 16.04:
in every project skip node_modules like this:
In the folder you want to be zipped: