Auto update Virus Definitions using ftp to get latest file

April 15, 2012 at 04:24:04
Specs: Windows 7
I'm currently trying to automate my updates for Symantec Endpoint Protection.
My objective is to download, via ftp, the latest definitions. (I have other computers on the network which will be looking at my computer for the file as they dont have internet access)
My current script looks like this (please keep in mind, I'm an amateur scripter):

open ftp.symantec.com
anonymous
nobody@spammer.com
cd AVDEFS/norton_antivirus/ C:\Symantec Updates\Update Files\
bin
hash
prompt
dir *-v5i32.exe
mget *-v5i32.exe
bye

This is the output from dir *-v5i32.exe

-rw-rw-r-- 1 1994 1994 154483784 Apr 10 14:45 20120410-003-v5i32.exe
-rw-rw-r-- 1 1994 1994 154529344 Apr 10 23:10 20120410-020-v5i32.exe
-rw-rw-r-- 1 1994 1994 154584792 Apr 11 07:12 20120410-036-v5i32.exe
-rw-rw-r-- 1 1994 1994 154586208 Apr 11 13:31 20120411-003-v5i32.exe
-rw-rw-r-- 1 1994 1994 154576576 Apr 11 23:04 20120411-019-v5i32.exe
-rw-rw-r-- 1 1994 1994 154642800 Apr 12 04:48 20120411-034-v5i32.exe
-rw-rw-r-- 1 1994 1994 154692744 Apr 12 13:43 20120412-001-v5i32.exe
-rw-rw-r-- 1 1994 1994 154653312 Apr 12 22:56 20120412-018-v5i32.exe
-rw-rw-r-- 1 1994 1994 154758288 Apr 13 05:08 20120412-032-v5i32.exe

Seeing as Symantec add a new file daily, Is there a way i can just download the latest file?
Any help will be greatly appreciated


See More: Auto update Virus Definitions using ftp to get latest file

Report •


#1
April 23, 2012 at 05:00:29
This will work as long as the last file listed in the dir output is always the latest file:

@echo off
if exist _.ftp del _.ftp
>_.ftp echo open ftp.symantec.com
>>_.ftp echo anonymous
>>_.ftp echo nobody@spammer.com
>>_.ftp echo cd AVDEFS/norton_antivirus/ C:\Symantec Updates\Update Files\
>>_.ftp echo bin
>>_.ftp echo hash
>>_.ftp echo prompt
>>_.ftp echo dir *-v5i32.exe
>>_.ftp echo bye
for /f "tokens=9" %%i in (
'ftp -s:_.ftp'
) do (
set file=%%i
)
>_.ftp echo open ftp.symantec.com
>>_.ftp echo anonymous
>>_.ftp echo nobody@spammer.com
>>_.ftp echo cd AVDEFS/norton_antivirus/ C:\Symantec Updates\Update Files\
>>_.ftp echo bin
>>_.ftp echo hash
>>_.ftp echo prompt
>>_.ftp echo get %file%
>>_.ftp echo bye
ftp -s:_.ftp
del _.ftp >nul

Tony


Report •
Related Solutions


Ask Question