How to Make a Zip File Excluding Specific Files and Folders

zip -r my-plugin.zip . \
-x "blocks/src/*" "blocks/package.json" "blocks/package-lock.json" ".gitignore" ".git/*" "node_modules/*" ".vscode/*" ".DS_Store"

Explanation:

  • zip -r my-plugin.zip .: Create a zip file named my-plugin.zip from the current directory (.)
  • -x: Exclude the following paths:
  • “blocks/src/*” — all files inside blocks/src
  • “.gitignore” — the ignore file
  • “package.json” — Node config
  • “package-lock.json” — Node lockfile
  • “.git/*” — entire Git folder

Similar Posts

Add your first comment to this post