In SQL Image Viewer 9.10, we added an option to allow you to run an application on each exported file. So say your database contained zip archives, and you use SQL Image Viewer to export those zip archives to disk. Using the post processing option, you can then use your favorite archiver to extract the files from the zip archives.
The post processing option is only available when you choose the Export images and files option.
In the export wizard, you will find the option on the Log, Email, and Post-processing Options page.
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. There are 4 tags you can use to represent the exported file to process. Given a file name of f:\temp\exports\0002_0003.zip:
- <FILENAME> returns f:\temp\exports\0002_0003.zip
- <FILENAME_PATH> returns f:\temp\exports\
- <FILENAME_NOPATH> returns 0002_0003.zip
- <FILENAME_NOPATH_NOEXT> returns 0002_0003
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.
One last option is the Delete file after successful processing item. Selecting this will cause SQL Image Viewer to delete the exported files if the processing application returns an exit code value of 0. Most command line applications do that. A non-zero exit code usually signifies an error.
We hope you find this option useful. If you want to use an application that requires some parameters using the input file that’s not provided by any of our tags, drop us a line at firstname.lastname@example.org, and we’ll try to help you out.