Here is an example of the script I use to download the norton AV files off the FTP server...
code:
BREAK ON
? "[ Start NAV Update Script... ]"
IF @MONTHNO < 10
$MONTH = "0" + "@MONTHNO"
ELSE
$MONTH = "@MONTHNO"
ENDIF
IF @MDAYNO < 10
$DAY = "0" + "@MDAYNO"
ELSE
$DAY = "@MDAYNO"
ENDIF
$FILENAME = $MONTH + $DAY + "x86.exe"
? $FILENAME
$NL = CHR(13) + CHR(10)
$PATH = "C:\scripts\nav"
;==========================================================
DEL "$PATH\ftp.txt"
$RC = OPEN(1,"$PATH\ftp.txt",5)
$RC = WRITELINE(1,"open ftp5.symantec.com" + $NL)
$RC = WRITELINE(1,"anonymous" + $NL)
$RC = WRITELINE(1,"me" + chr(64) + "mail.com" + $NL)
$RC = WRITELINE(1,"cd public/english_us_canada/antivirus_definitions/norton_antivirus" + $NL)
$RC = WRITELINE(1,"binary" + $NL)
$RC = WRITELINE(1,"get $FILENAME" + $NL)
$RC = WRITELINE(1,"quit" + $NL)
$RC = CLOSE(1)
;==========================================================
? "[ Connecing to FTP Server ]"
CD "C:\scripts\nav\_update\new"
SHELL "C:\WINNT\System32\cmd.exe /C FTP -s:$PATH\ftp.txt"
IF @ERROR <> 0
BEEP
? "SHELL failed with ERRORCODE : [" + @ERROR + "]"
ENDIF
CD "$PATH"
;==========================================================
$RC = OPEN(2,"$PATH\getnav.log",5)
$RC = WRITELINE(2,"==========================================" + $NL)
$RC = WRITELINE(2,"[ @date ] " + "[ @time ]" + "[ $FILENAME ]" + $NL)
$RC = WRITELINE(2,"==========================================" + $NL)
$RC = CLOSE(2)
;==========================================================
IF EXIST ("$PATH\_update\new\$FILENAME")
? "[ New File exists. Copying " + $FILENAME + " to Network ]"
CALL "$PATH\copy.kix"
GOTO END
ELSE
? "[ No Update file for this session = $FILENAME ]"
GOTO END
ENDIF
;==========================================================
:END
? "[ End NAV Update Script... ]" + $NL
EXIT
But now since they started naming the files differently (since 08.12.02) "20020815-XXX-x86.exe" I cannot figure how to get the script to work right. The '-XXX-' part of the name changes as they modify the file and give it a revision number. Who knows how many times they will revise a file.
I tried this...
code:
$FILENAME = "@YEAR" + "$MONTH" + "$DAY" + "-*-x86.exe"
(quotes needed to cast as string, otherwise the numbers are 'added')
But FTP.exe don't handle the '*' in there.
Any help will be greatly appreciated!!
Rocco