You have to use -xr
rather than just -x
to tell 7z
that the excluded files are in a subdirectory. You have taken -xr
for the git
tree.
If delayed expansion
of environment variables is active in your script, you have to escape the !
. Write ^^!
instead.
Example:
7z a -r -ssw -mx9 -xr!"~$*" c:\target\xxx.7z c:\myfolder\*.*