Attached is a new updfprot script using wget instead of ftp.  It does not
download the files unless they are updated.  It's also marginally smarter
about unzipping the files and won't even attempt it unless a new file has been
downloaded.

I use the wget included with cygwin(www.cygwin.com), but I checked
compatibility with the non-cygwin Win32 binary at www.wget.org (follow the
links) and it seems OK.

As always, it is provided as is with no promises. Use at your own risk. It
works for me, but may kill your machine, destroy your data,  and end
civilization as we know it.

Jerry




rem Update of F-Prot update program to eliminate redundant downloads.
rem Requires info-zip's unzip.exe 5.42 www.info-zip.org
rem Requires gnu wget, links to Windows binaries at www.wget.org or www.cygwin.com
rem Will keep the last three versions of f-prot on disk. 

SETLOCAL

:Set Path Info
SET fprotdrv=f:
SET fprotdir=\vscan\FPROT
SET DownloadDir=%fprotdrv%%fprotdir%\update

:Set Unzip Command Info
SET unzipcmd=UNZIP -o -u
SET unziptail=-x f-prot.pif -d %fprotdrv%%fprotdir%

:Set FTP Info
SET wgetcmd=c:\cygwin\bin\wget.exe 
SET BaseURL=ftp://ftp.f-prot.com/pub

:CheckDirectories
md %fprotdrv%%fprotdir%
md %DownloadDir%
if not exist %DownloadDir% goto end

:FTPDownload
%wgetcmd% -t 2 -N -nv -P %DownloadDir% %BaseURL%/fp-3*.zip %BaseURL%/fp-def.zip 
%BaseURL%/macrdef2.zip  2>&1 | find "in 0 files"
if errorlevel 1 goto UnzipFiles
goto end 

:UnzipFiles
SET T=0
for /F %%I in ('dir %DownloadDir%\fp-3*.zip /a-d-s /b /o:-d') do call :DoNewVersion 
%DownloadDir%\%%I 
%unzipcmd% %DownloadDir%\fp-def.zip %unziptail%
%unzipcmd% %DownloadDir%\macrdef2.zip %unziptail%

:Cleanup 
attrib -r %DownloadDir%\*.zip
if exist %fprotdrv%%fprotdir%\f-prot.pif del %fprotdrv%%fprotdir%\f-prot.pif
goto end

:DoNewVersion
SET /a T = 1+%T%
if %T% EQU 1 %unzipcmd% %1 %unziptail%
if %T% LEQ 3 goto :DoNewVersion_exit
if exist %1 del /F %1  
:DoNewVersion_exit
echo %T%
goto :EOF

:END
ENDLOCAL

Reply via email to