Unix zip directory but excluded specific subdirectories (and everything within them)
Fresh3 days ago
Mar 15, 2026319752 viewsConfidence Score1%
1%
Problem
I'm trying to zip a directory (on Unix via SSH) but I need to exclude a couple of subdirectories (and all files and directories within them). So far I have this: That doesn't seem to work though. I also tried However that will still include subdirectories within ignoreDir1 and ignoreDir2. The subdirectory structure in the directories that I want to exclude is quite substantial so I can't simply add each directory to the -x argument. Does anyone know how to do this?
Error Output
zip -r myarchive.zip dir1 -x dir1/ignoreDir/**/*
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: Unix zip directory but excluded specific subdirectories (and everything within them)
Low Risk
The actual command I need is:
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix