How to uncompress file archives such as 7Z and RAR using IDL on Windows
Anonym
Although the IDL procedures FILE_GUNZIP, FILE_UNTAR and FILE_UNZIP make uncompressing of GZIP, TAR and ZIP easy, there is unfortunately no IDL own procedure to uncompress files like 7Z or RAR.
However using IDL’s powerful SPAWN procedure allows for uncompressing these files by making use of 7-Zip’s or WinRAR’s command line mode.
Note: An installation of either 7-Zip or WinRAR is required.
The following examples will extract all files included in file ‘archive.rar’ to its source directory.
Example using 7-Zip:
SPAWN, '"C:\Program Files\7-Zip\7z.exe" e C:\Documents\archive.rar'
Example using WinRAR:
SPAWN, '"C:\Program Files\WinRAR\WinRAR.exe" e C:\Documents\archive.rar'
Please see the 7-Zip Help or the WinRAR online manual for a list of all supported file formats as well as a list of available commands and flags.