Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I'm currently trying to automate my updates for virus scanners, specifically Norton Antivirus. My objective is to download, via ftp (using wget.exe) the latest Intelligent Updater antivirus definitions. Then extract the defenitions, only from the latest file, to another directory.
My current script looks like this (please keep in mind, I'm an amature scripter):
-
wget ftp://ftp.symantec.com/public/english_us_canada/antivirus_definitions/norton_antivirus/2005*-
i32.exe -N2005*-i32.exe /extract c:\norton\virusdef
-Well my dilema is, by performing this form of download of the antivirus definitions, there are usually more than one file that gets downloaded. So by using the wildcard "*" to execute the extraction process, it doesn't know what file to extract from, say if there were three files that matched "2005*-i32.exe".
So what I'm looking for is a way to run a batch script that will pinpoint the latest of these executable files, set that filename as a variable, then use that variable to extract the definitions to the folder of my liking.
Example:
wget <filename>
find latest <filename>
set latest <filename> = variable
variable /extract <location of my choice>Do not know if this is possible, but I figured I would ask.
Thanx,
Enigmafyv

Oh, one other thing that I forgot to mention. I only want to cache the latest three Intelligent Updater antivirus definition files, anything earlier I would like the script to verify and delete. If this could be figured in at the same time, I'd be grateful.
Enigmafyv

If Symantec is as sensible as we hope, the file names will reflect their relative ages.
2005*-i32.exe
Maybe the files you get will be:
20050202-i32.exe
20050411-i32.exe
20050525-i32.exeIn that case you can:
for %%E in ('dir /b/on 200*.exe) do set latest=%%E
HTH
M2
If at first you don't succeed, you're about average.

Here are the results of running this batch. It doesn't seem as though it worked. Or maybe I'm wrong and I really don't know what I'm doing.
result:
C:\folder\folder>for %E in ('dir /b/on 200*.exe) do set latest=%EC:\folder\folder>set latest='dir
C:\folder\folder>set latest=/b/on
C:\folder\folder>set latest=20050620-007-i32.exe
C:\folder\folder>set latest=20050621-008-i32.exe
C:\folder\folder>set latest=20050622-017-i32.exe
C:\folder\folder>set latest=20050623-007-i32.exe

Hi,
Sorry. My mistake.
I left out two things.
Try this:
for /f %E in ('dir /b/on 200*.exe') do set latest=%E
M2
If at first you don't succeed, you're about average.

It sets the variable "latest" to the name of the latest EXE file.
So you could:
COPY %latest% c:\work\
or something similar.
M2
If at first you don't succeed, you're about average.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |