How do I disable 7-Zip directory scan for directories which are not meant to be compressed and added to the archive?

I was asking the same question at the official 7-Zip forums, and got the reply from Igor Pavlov. I would like to get the answer from Igor at the site, but he seems not to have an account here. He suggests just to remove the -r switch, since 7z uses recursive search by default:

Your command searches empty file or folder in all subfolders.
Remove -r switch.

http://7-zip.org/faq.html

Here is the respective excerpt from the official FAQ:

Why doesn't -r switch work as expected?

In most cases you don't need -r switch. 7-Zip can compress subfolders even without -r switch.

Example 1:
7z.exe a c:\a.7z "C:\Program Files"
compresses "C:\Program Files" completely, including all subfolders.

Example 2:
7z.exe a -r c:\a.7z "C:\Program Files"
searches and compresses "Program Files" in all subfolders of C:\ (for example, in "C:\WINDOWS").

If you need to compress only files with some extension, you can use -r switch:
7z a -r c:\a.zip c:\dir\*.txt
compresses all *.txt files from folder c:\dir\ and all it's subfolders.