I would like to use the unix zip command to zip a directory. Let's say the directory is structured as follows:
dir1/
dir1/dir2/
dir1/dir2/file1
dir1/dir2/file2
dir1/dir3
dir1/dir3/file1
dir1/file1
dir1/file2
I would like to zip dir1
into dir1.zip
such that dir1.zip
contains dir1/file1, dir1/file2, dir1/dir2/file1, dir1/dir2/file2, dir3/
, but NOT dir1/dir3/file1
. In short, I'd like to zip all of the FILES under dir1
, dir2
and all of its files, and dir3
but NONE of its files.
If I do zip dir1 dir1/
, it will zip everything in dir1
, all of its files and subfolders but not the contents of the subfolders. If I do zip -r dir1 dir1/
, it will zip everything in dir1
, including all of its files and all of the files of its subfolders. I would like to be able to control which subfolders should be zipped recursively and which shouldn't.
Thanks.
-i
option. Does that not work for you?