Zip folder recursively, save for a given sub folder (Linux) Zip folder recursively, save for a given sub folder (Linux) linux linux

Zip folder recursively, save for a given sub folder (Linux)


zip -r base_folder.zip base_folder -x base_folder/sub_folder/\* base_folder/another_sub_folder/\*

(I have incorporated the improved information from your experience that you have kindly offered in your comment.)

For more information: man zip


You can use tar with --exclude, and use the -z option to gzip the output tar file.


find the files, exclude the folder, xargs the remaining files to tar or zip or whatever:

find /in/your/dir | grep -v 'name_of_dir_to_be_excluded' | xargs tar jcvf nameOfArchive.tar.bz2