7Zip Commandline: How to include a particular file within an excluded folder?

  7zip, command, exclude, file, windows

In Windows 10, I have a subfolder named Objects which contains following folders and files

  • bin
  • gen
  • src
  • res
  • classes.dex
  • myapp.apk
  • test.txt

I want to exclude everything in the Objects folder except test.txt file.

Currently I use the following command to exclude everything in Objects folder

"C:Program Files (x86)-Zipz.exe" a -tzip ..Backup.zip * -mx0 -xr!Objects

How do I modify the above script to achieve that?


Source: Windows Questions