Sunday, July 10, 2016

Creating a very primitive installation tool: Using winzip to create archives that preserve directory structure

Even when i do an internal project, i like to create a quick installer package for anybody else who might want to use the tool(s). Winzip has a nice command line interface to make this happen, however it took an hour poking through documentation (and 7z proved non-obvious as to how to do it, and online notes suggested the developer is not too interested in making this use case easy..read about it on superuser.com).

The specific challenge is the right parameters to get the entire directory structure when you unzip at the destination. To me, this would be quite a useful mode of any zip/archive tool, yet the default is baffling a flat directory structure, surprise! Even using the GUI default modes does the expected thing..so it would seem NOT preserving the directory structure is the uncommon case, but that rant is not why i am writing this note for later.

So, here's the scoop:
using winzip, archive using this:
"c:\program files\winzip\wzzip" -P -r file.zip @BenchFileList.txt

where BenchFileList.txt has a format like this:

".\docs\bench-overview.pptx"
".\docs\sim-overview.pptx"
".\docs\GPU Architectures.docx"
".\docs\queues-and-contexts.pptx"

".\Bench\source\Bench.sln"

DO NOT INCLUDE THE '.' IN THE STRINGS IF YOU WANT IT TO SHOW THE DIRECTORY NAMES AT THE TOP.

and you will get what you expect: when you unzip you will have a directory structure such that your solution and project files are where they are expected to be.

--adam

No comments: