Example: using 7-zip to extract files
|Top Previous Next|
In this example, we will be using the 7zip command-line interface to extract the contents of our zip files.
The most important thing to note here is that whichever application you use, it needs to complete regardless of its execution status. For example, in 7zip, if a file of the same name already exists, it will prompt you to overwrite or skip the file extraction.
You cannot allow this to happen when running the application from within SQL Image Viewer, because you cannot respond to the application from within SQL Image Viewer, and thus will block the export process. To prevent this in our example, we use the -aoa flag to choose to always overwrite any existing files.
So to run your application, enter the fully qualified name to its executable file. In our example, that's E:\Program Files (x86)\7-zip\7z.exe. Because the path contains spaces, we need to enclose them in double quotes.
After the executable path name, enter the required options for your application. As mentioned here, there are 4 tags you can use to represent the exported file to process. In our example, we want to extract the files from our zip archive, so we use the e option. We then need to provide the archive file name, which we do so using the <FILENAME> tag. Again, we enclose the <FILENAME> tag in double quotes in case it contains spaces.
We then want to specify the folder to extract the items into, using the -o option. In this case, we want to extract the files into a subfolder using the zip file name. So given a zip file name of f:\temp\exports\0002_0003.zip, the contents of that zip file will be extracted into the f:\temp\_dump\0002_0003 folder. Now after every zip file has been extracted to disk, SQL Image Viewer will run 7-zip to extract the contents of the zip files.