How to exclude a folder in 7zip?

As tested on my system:

7zip a -t7z -mx0 -x!test\* test.7z c:\temp\ 

If you're in the source directory, the files are stored with relative paths, so the test folder looks like test\file1.txt, not c:\temp\test\file1.txt.

Please note, with the -mx0 switch, you're not compressing the files, only copying them fullsize into the archive.