When zipping a folder using the command line in macOS, you may have noticed certain files are include such as DS_Store and __MACOSX are included. With a few command arguments, these files can be filtered out.
Exclude All Hidden Files
zip -r zipFolderName.zip pathToFolder -x "*.*"
Exclude .DS_Store and __MACOSX
zip -r zipFolderName.zip pathToFolder -x "*.DS_Store" "__MACOSX*"
Exclude all jpegs
zip -r zipFolderName.zip pathToFolder -x "*.jpegs"
Hopefully this helps you filter out unwanted files when zipping folders in macOS.