When deploying a project to a certain customer’s servers, for a couple of reasons, we have to do it by manually copying over the files to a certain directory over RDP and SSL VPN. To speed up the transfer, we zipped the files on our development machines, since it’s quicker to copy one big file than many small ones.
Unzipping on the (Windows) server was a bit tedious (right-click, extract here, yes overwrite, etc.) so we cooked up a small VBScript that did the extraction. The code below is saved as ‘unpack.vbs’.
Set fso = CreateObject("Scripting.FileSystemObject")
sourceFile = fso.GetAbsolutePathName(ZipFile)
destFolder = fso.GetAbsolutePathName(ExtractTo)
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(destFolder).copyHere FilesInZip, 16
Set fso = Nothing
Set objShell = Nothing
Set FilesInZip = Nothing
The code contains the hardcoded name of the zip file, gets the absolute path names of the source and destination, followed by instructions to copy the files from the zip to destination. The ’16’ in the options means to overwrite without asking. Finally, there’s some cleanup taking place.
What this script allows us to do is instead of manually unzip, choosing to overwrite, etc, just double click on this script file. That’s one itch less.
In a follow-up post, I’ll show you how we zip the files we want on OS X.