Here is the directory structure of the folder I am trying to archive:
DIR STRUCTURE
HOME
HOME/.abc
HOME/FIRST
HOME/FIRST/.def
I am using simlpe $PATCH/zip -r -l -x "bac*" abc.zip HOME/*
One interesting thing I obseverved was it is skipping hidden folder directly under HOME and it zips the one under FIRST. What am I missing here? Is it any side effect of the options I am chosing ? Please help thanks in advance.
*is not interpreted by the zip utility, but rather expanded by the shell. Before the zip utility is executed,*is replaced by a space separated list of all the non-hidden files or directories.You can prove this by replacing
$PATCH/zipwithecho, which will show the arguments that are actually passed to the program, after shell mangling.If you set the environment variable
GLOBIGNOREto.:.., not only will bash disable the matching of.and.., it has the nice effect of also automatically enabling ‘dotglob’, which matches the other hidden files without the need for.*, so you can just use*for everything.For example, this should solve your problem:
Note that you cannot do this the short way, or in one command:
It seems that bash doesn’t notice this until the next command.