0

I have a folder structure of:

-MAIN
-- Branches
---001
---002
---003

I want to zip 003 up so I have a zip of

-MAIN
--Branches
---003

I'm using:

7z a "C:\My Files.zip" "C:\MAIN\Branches\003" 

But this gives me a folder of just 003 in My Zip without the folders before it.

Any ideas?

DavidPostill
  • 153,128
  • 77
  • 353
  • 394
Ian
  • 1
  • 1
    this is expected. you added only that folder. you need to start from top and exclude all what you don't want - [see here](https://superuser.com/questions/97342/7zip-command-line-exclude-folders-by-wildcard-pattern) – Zina Jun 01 '20 at 15:12
  • I'm struggling to see if I can apply that logic, I use a variable of %branch% to identify 001 / 002 / 003. I'm not sure how i'd exclude the folders i didn't want without explicitly calling them out. – Ian Jun 02 '20 at 10:19
  • 1
    unfortunately yes, you will need to specify them, I suggest you make two files eg. exclude.txt and include.txt and call 7zip with the @filename for include and exclude parameters – Zina Jun 02 '20 at 14:00

0 Answers0