How do I exclude hidden directories when creating an archive using 7zip's command line version?
I tried -x!".*"
, but that didn't work.
You need to add the r
("recurse") flag to the -x
option if you want it to match files inside subdirectories.
For example, the following creates an archive from the whole directory tree under folder/
except for any files that start with a dot:
7z a -xr'!.*' archive.7z folder/