Why won't excluding a specific folder work while I'm making a .zip file?
5,119
The zip man page says:
zip ... [zipfile [file ...]] [-xi list]
so, the zip file name and the path to the structure you want to compress should come before your exclude list.
This part of your command will not be applied correctly:
-x 'public/images/'
Because it does not specify files in the way zip recognises.
This will work:
zip -r my.zip /var/www/html/m4/ -x /var/www/html/m4/public/images/\*
- As you know,
-r
is recursive. -x
is used to exclude (files),\
before*
is used to avoid filename expansion by the shell; we leave that tozip
.
Related videos on Youtube
Author by
stack
Updated on September 18, 2022Comments
-
stack almost 2 years
I want to make a zip file of a directory except a specific folder which is into it. Here is my command:
zip -r -x 'public/images/' tw.zip /var/www/html/m4/
I want to make a zip of this
/var/www/html/m4/
exceptpublic/images/
folder which exists into it. But my command throws this error message:zip error: Invalid command arguments (nothing to select from)
What's wrong and how can I fix it?