IIS Logs – A script to decompress 1000’s easily.

I needed a way to decompress a folder of gzipped IIS logs so that I may run Microsoft Log Parser against them. Instead of using Windows Explorer to select all the files and put into memory to attempt to extract, it is more feasable to run a command line script to select each file one by one, extract it, and then go to the next file. To do this, requires a command line decompressor. The best freeware product on the market is 7zip’s 7za. Here is the script I used to extract the folder, recording the date and time that the process bagan and ended.

echo Backup Started on date time %date:~4,2%_%date:~7,2%_%date:~10,4% %time% >> decompressGZ_%date:~4,2%_%date:~7,2%_%date:~10,4%.txt
for %%i in ("*.gz") do 7za.exe e "%%i" -y >> decompressGZ_%date:~4,2%_%date:~7,2%_%date:~10,4%.txt
echo Backup Completed on date time %date:~4,2%_%date:~7,2%_%date:~10,4% %time% >> decompressGZ_%date:~4,2%_%date:~7,2%_%date:~10,4%.txt