home *** CD-ROM | disk | FTP | other *** search
/ ftp.ac-grenoble.fr / 2015.02.ftp.ac-grenoble.fr.tar / ftp.ac-grenoble.fr / assistance.logicielle / XDBdown_autonome.cmd < prev    next >
OS/2 REXX Batch file  |  2013-09-19  |  5KB  |  133 lines

  1. Del "C:\Documents and Settings\All Users\Application Data\Symantec\Symantec AntiVirus Corporate Edition\7.5\*.vdb" /q
  2.  
  3. @set COPY_XDB_TO="C:\Documents and Settings\All Users\Application Data\Symantec\Symantec AntiVirus Corporate Edition\7.5"
  4. @set RAPIDRELEASE=0
  5. @set XDBTEMP=%temp%
  6.  
  7. @rem ==============================================================================================
  8. @rem Set RAPIDRELEASE=1 to download repidrelease definitions, RAPIDRELEASE=0 for fully QA'd definitions (standard).
  9. @rem Change COPY_XDB_TO= to point to the SAV CE server directory (or where you want the XDB file copied)
  10. @rem   you can also run the script directly from the SAV folder and it will copy the definitions there.
  11. @rem XDBTEMP is the temp folder the script will use while downloading definitions, set to %temp% to use system default
  12. @rem ==============================================================================================
  13. @rem  Script for downloading virus definition updates for
  14. @rem  Symantec Antivirus Corporate Edition version 8.x and 9.x
  15. @rem  This unsupported utility is provided for your convenience only.
  16. @rem  Symantec Technical Support cannot provide support for the creation,
  17. @rem  use, or troubleshooting of Windows scripts.
  18.  
  19. @rem ==============================================================================================
  20. @echo off
  21.  
  22.  
  23. rem   ========= check that OS is win2k or better ============
  24. if not "%OS%" == "Windows_NT" goto BADOS
  25. if "%APPDATA%" == "" goto BADOS
  26.  
  27. rem   ========= make sure to be in script directory ============
  28. if exist rtvscan.exe set COPY_XDB_TO=%CD%
  29. for %%i in (%0) do @%%~di
  30. for %%i in (%0) do @cd %%~pi
  31. if exist rtvscan.exe set COPY_XDB_TO=%CD%
  32.  
  33. rem   =========== get name/size of last file from "xdbdown.lastfile" ============
  34. if not exist xdbdown.lastfile goto NOLAST
  35. for /f "tokens=1" %%f in (xdbdown.lastfile) do set lastfile=%%f
  36. for /f "tokens=2" %%f in (xdbdown.lastfile) do set lastsize=%%f
  37. :NOLAST
  38.  
  39. rem   ========= jump to temp dir ============
  40. if not exist "%XDBTEMP%\xdbtmp" md "%XDBTEMP%\xdbtmp"
  41. if exist "%XDBTEMP%\xdbtmp\*.xdb" del "%XDBTEMP%\xdbtmp\*.xdb"
  42. pushd "%XDBTEMP%\xdbtmp"
  43.  
  44. rem   =========== make ftp script for checking xdb directory on ftp ===========
  45. echo open ftp.symantec.com> check.txt
  46. echo anonymous>> check.txt
  47. echo email@address.com>> check.txt
  48. set xdbfolder=xdb
  49. if "%RAPIDRELEASE%" == "1" set xdbfolder=rapidrelease
  50. echo cd AVDEFS/norton_antivirus/%xdbfolder%>> check.txt
  51. echo dir *.xdb chk.lst>> check.txt
  52. echo bye>> check.txt
  53.  
  54. rem   =========== get filename and size from ftp ============
  55. if exist chk.lst del chk.lst
  56. ftp -s:check.txt
  57. if not exist chk.lst goto ERROR
  58. for /f "tokens=9" %%f in (chk.lst) do set xdbfile=%%f
  59. for /f "tokens=5" %%f in (chk.lst) do set xdbsize=%%f
  60. if "%xdbfile%" == "" goto ERROR
  61. if "%xdbsize%" == "" goto ERROR
  62.  
  63. rem   =========== compare ftp name/size to local ============
  64. if not "%xdbfile%" == "%lastfile%" goto DOWNLOAD
  65. if not "%xdbsize%" == "%lastsize%" goto DOWNLOAD
  66. popd
  67. echo.
  68. echo Already downloaded latest %xdbfolder% file: %xdbfile% - size %xdbsize%
  69. echo %date% %time%  Already downloaded latest %xdbfolder% file: %xdbfile% - size %xdbsize% >> XDBdown.log
  70. goto END
  71.  
  72. :DOWNLOAD
  73. rem   ========= make ftp script for downloading new xdb file =========
  74. echo open ftp.symantec.com> down.txt
  75. echo anonymous>> down.txt
  76. echo email@address.com>> down.txt
  77. echo cd AVDEFS/norton_antivirus/%xdbfolder%>> down.txt
  78. echo bin>> down.txt
  79. echo hash>> down.txt
  80. echo get %xdbfile%>> down.txt
  81. echo bye>> down.txt
  82.  
  83. rem   ============= download new file =================
  84. ftp -s:down.txt
  85. for %%i in (%xdbfile%) do @set newsize=%%~zi
  86. if not "%newsize%" == "%xdbsize%" goto ERROR
  87. move %xdbfile% %COPY_XDB_TO%
  88. if exist %xdbfile% goto ERRORMOVE
  89. popd
  90. echo.
  91. echo %xdbfile% %xdbsize% > xdbdown.lastfile
  92. echo Downloaded new %xdbfolder% file: %xdbfile% - size %xdbsize%
  93. echo %date% %time%  Downloaded new %xdbfolder% file: %xdbfile% - size %xdbsize% >> XDBdown.log
  94. goto END
  95.  
  96.  
  97. :ERROR
  98. popd
  99. echo.
  100. echo ERROR: problem downloading %xdbfolder% definition file. xdbfile=%xdbfile% xdbsize=%xdbsize% newsize=%newsize% (lastfile=%lastfile% lastsize=%lastsize%).
  101. echo %date% %time%  ERROR: problem downloading %xdbfolder% definition file. xdbfile=%xdbfile% xdbsize=%xdbsize% newsize=%newsize% (lastfile=%lastfile% lastsize=%lastsize%). >> XDBdown.log
  102. type "%XDBTEMP%\xdbtmp\chk.lst" >> XDBdown.log
  103. echo.  >> XDBdown.log
  104. goto END
  105.  
  106. :ERRORMOVE
  107. popd
  108. echo.
  109. echo ERROR: problem moving definition file to SAV folder. COPY_XDB_TO=%COPY_XDB_TO%  newsize=%newsize% (lastfile=%lastfile% lastsize=%lastsize%).
  110. echo %date% %time%  ERROR: problem moving definition file to SAV folder. COPY_XDB_TO=%COPY_XDB_TO%  newsize=%newsize% (lastfile=%lastfile% lastsize=%lastsize%). >> XDBdown.log
  111. goto END
  112.  
  113. :BADOS
  114. echo.
  115. echo ERROR: this script needs Windows 2000 or better.
  116. echo %date% %time%  ERROR: this script needs Windows 2000 or better. >> XDBdown.log
  117. goto END
  118.  
  119. :END
  120. if exist "%XDBTEMP%\xdbtmp\check.txt" del "%XDBTEMP%\xdbtmp\check.txt"
  121. if exist "%XDBTEMP%\xdbtmp\down.txt" del "%XDBTEMP%\xdbtmp\down.txt"
  122. if exist "%XDBTEMP%\xdbtmp\chk.lst" del "%XDBTEMP%\xdbtmp\chk.lst"
  123. rd "%XDBTEMP%\xdbtmp"
  124. set COPY_XDB_TO=
  125. set RAPIDRELEASE=
  126. set lastsize=
  127. set lastfile=
  128. set newsize=
  129. set xdbsize=
  130. set xdbfile=
  131. set xdbfolder=
  132. set xdbtemp=
  133.