Ziptest
This is a couple of useful scripts to test downloaded files.
This approach is recommended when downloading huge amounts of data like when downloading Oracle R12 installations files.
In addition to testing the downloaded files also be sure to use a download manager.
The basic zip test command is:
$ unzip –t –qq {zipfile}
I made a Linux script for it named ziptest.sh:
#!/bin/bash # ziptest.sh SOURCE=/util/install/R12.1.1-32 if [ -z “$1″ ] then name=”*.zip” else name=”$1.zip” fi for zipfile in $SOURCE/$name do unzip -t -qq $zipfile if [ $? -eq 0 ] then echo -n “.” else echo ” ” fi done echo ” “ |
A similar script can be made for Windows names ziptest.cmd:
@echo off rem ziptest.cmd {zipfilename} set zipdir=..\R12.1.1-32 rem do all zip files unless arg received set zipfile=*.zip if [%1]==[] goto doit set zipfile=%1.zip :doit set target=%zipdir%\%zipfile% for %%a in ( %target% ) do call ziptest_call %%a |
As command line programming in windows isn’t great we need to call a subprogram names ziptest_call:
@echo off rem ziptest_call.cmd {zipfile} if [%1]==[] goto noarg if not exist %1 goto nofile :main unzip –t –qq %1 if errorlevel 1 goto badfile goto xit :noarg echo ARG missing – use only with ziptest.cmd goto xit :nofile echo FILE %1 does not exist goto xit :badfile echo %1 BAD goto xit :xit |
That should be it.
Be sure to update directory references for your own purpose.