0

We have a batch file that uses Windows 10 builtin zip functionality to zip folders. That is so unpredictable and fails in the middle of 1 hr batch job which requires us start the whole process again. The windows builtin zip functionality is not a console app. It brings up user interface elements and fails if someone doesn't click Ok button.

So I started playing with 7z. It is portable app with no dependencies and it is fast. I have a batch file where the current working dir is say c:\work\abuild\job. It has a sub folder maintool\vendorA. I am trying to create a zip file of vendorA folder by passing c:\work\abuild\job\maintool\vendorA as parameter. It is creating the zip with vendorA only content, but retaining the whole c:\work\abuild\job\maintool\vendorA path inside the zip. When extracted, it is ending up creating that folder structure which I don't want.

I looked at all the available command line parameters for 7z. I didn't find one that lets me do this. Instead of using absolute path, if I use a relative path that starts with .\, I can achieve what I want. But that requires total rewrite of this batch file. It is part of bigger batch file solution.

I would be surprised if I am the first one running into this problem. There must be a solution to do this. But I don't know how.

Thanks for your suggestions.

videoguy
  • 201

0 Answers0