Search code examples
batch-filewinzip

WZZIP create zip file excluding 2 folder + subfolders


I have both winzip and the command line addon installed and I am trying to write a .bat file to zip up a certain folder on one of my drives. What I would like is create a zip from a folder but I need to exclude 2 folders (with subfolders) from the zip. The code I have so far that works is:

wzzip -r -p "H:\Temp\Files Backup".zip "D:\test folder 1\"

I would like it to missed folders D:\test folder\sub folder 4\ & D:\test folder\sub folder 9\ but zip up all the other folders and sub folders.

I have tried:

wzzip -r -p "H:\Temp\Files Backup".zip "D:\test folder 1\" -x "D:\test folder\sub folder 4\" "D:\test folder\sub folder 9\"

But that errors saying "ERROR: missing string after option -x
Program is terminating!

Also tried:

wzzip -r -p "H:\Temp\Files Backup".zip "D:\test folder 1\" -x"D:\test folder\sub folder 4\" "D:\test folder\sub folder 9\"
wzzip -r -p "H:\Temp\Files Backup".zip "D:\test folder 1\" -x:"D:\test folder\sub folder 4\" "D:\test folder\sub folder 9\"
wzzip -r -p "H:\Temp\Files Backup".zip "D:\test folder 1\" -xd:"D:\test folder\sub folder 4\" "D:\test folder\sub folder 9\"

I don't what else to try as if I use winzip32 the syntax is different and if I use 7zip it is different again


Solution

  • With the help of @Compo this was my final solution:

    wzzip -r -p "H:\Temp\Files Backup".zip "D:\test folder 1" -x"D:\test folder 1\sub folder 4\*" -x"D:\test folder 1\sub folder 9\*"