I am attempting to use the zip command with the '-x' option to exclude a folder e.g. 'zip upload.zip public_html -x public_html/jquery/*'. However, parts of this folder are still being added to the archive. I made a shell script (saved as 'compress.sh' and ran as '. compress.sh') to do the archiving so I could test adding nested wildards for multiple subfolder levels.
rm -f upload.zip
zip -r upload.zip public_html \
-x public_html/jquery \
-x public_html/jquery/ \
-x public_html/jquery/* \
-x public_html/jquery/*/* \
-x public_html/jquery/*/*/* \
-x public_html/jquery/*/*/*/* \
-x public_html/jquery/*/*/*/*/* \
-x public_html/jquery/*/*/*/*/*/* \
Each new line I added here that has the nested wildcards made the archive file size a bit smaller. Adding more /*'s than this didn't affect the file size. Even after all this though, there were still a couple megabytes of files and folders from the 'jquery' directory that were added to the archive.
Here's some examples of files and folders that were created after I unzipped the archive:
Why is it that despite all the -x lines, the files and folders like these were still being added to the archive? How can I simply recursively exclude the entire public_html/jquery folder from the archive?