I’ve taken much of the following script from Rene Baca over at cgTalk. I’ve edited the scripts slightly, added some error-trapping and added a lot of comments. This should make it easier for any scripter to to figure out what the script is doing.
A new feature I’m just implementing in some of my scripts is multithreading. It’s not always very useful and definitely not error-free. For zipping larger files however it’s very useful. I’ve added the option to use the zip-method singlethreaded or multithreaded. For more info in multithreading, check out the article by Lonerobot on this topic.
It’s practical to set up a commandstring as the command is executed with hiddendoscommand. Setting up the string is pretty flexible. In my experience you can only zip stuff to and from mapped drives.
util = (getDir #maxRoot) + "maxzip.exe" --the zipping-program zipFile = targetFolderPath + "zippy.zip" sourceFile = someFile --a single file to zip cmd = "" as stringStream --set up a zipping-command format "\"%\" \"%\" \"%\"" util zipFile sourceFile to:cmd --the commandstring (hiddendosCommand cmd exitcode:&exitcode) --EXECUTE THE ZIPPING
Here a single file is zipped. The struct works with multiple files and recursively searches a root-folder.