Anyone know how to complete this script?

  • Thread starter Thread starter Zak
  • Start date Start date
Z

Zak

I'm trying to create a batch file to automatically download the sdat file
from McAfee. Is there a wildcard for ftp?
I need to have a wildcard for the "get sdat????.exe" as the ???? part of
the file name is a changing number.

open ftp.nai.com
anonymous
(e-mail address removed)
cd pub/antivirus/superdat/intel
lcd C:\
bin
hash
prompt
get sdat????.exe
quit

Thanks,

Z
 
You can use a "for loop" and start with a range like 4420 - 4424

Then you can set an envionmental variable such as "DAT" and call it in a script

Then you can create a text file (FTP-CMD.TXT) of commands that can then be used by using FTP
with the switch -s:FTP-CMD.TXT

In the batch file use file redirection such as the following to create the text file ...

echo open ftp.nai.com >FTP-CMD.TXT
echo anonymous >>FTP-CMD.TXT
echo (e-mail address removed) >>FTP-CMD.TXT
echo cd pub/antivirus/superdat/intel >>FTP-CMD.TXT
echo lcd C:\ >>FTP-CMD.TXT
echo bin >>FTP-CMD.TXT
echo hash >>FTP-CMD.TXT
echo prompt >>FTP-CMD.TXT
echo get sdat%DAT%.exe >>FTP-CMD.TXT
echo quit >>FTP-CMD.TXT

%comspec% /c start /wait FTP -s:FTP-CMD.TXT

FTP Command Syntax
----------------------------
Transfers files to and from a computer running an FTP server service
(sometimes called a daemon). Ftp can be used interactively.

FTP [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-w:windowsize] [-A] [host]

-v Suppresses display of remote server responses.
-n Suppresses auto-login upon initial connection.
-i Turns off interactive prompting during multiple file
transfers.
-d Enables debugging.
-g Disables filename globbing (see GLOB command).
-s:filename Specifies a text file containing FTP commands; the
commands will automatically run after FTP starts.
-a Use any local interface when binding data connection.
-A login as anonymous.
-w:buffersize Overrides the default transfer buffer size of 4096.
host Specifies the host name or IP address of the remote
host to connect to.

Notes:
- mget and mput commands take y/n/q for yes/no/quit.
- Use Control-C to abort commands.

-------------

The following is my TEST.BAT

If you use TEST.BAT 4423 it will download SDAT4423.exe. You can use that as the basis to in
your script to either manually feed the current revision or loop throuugh a series of
numbers represnting the latest McAfee DAT revision.

test.bat
---------
echo off
set DAT=%1
echo open ftp.nai.com >FTP-CMD.TXT
echo anonymous >>FTP-CMD.TXT
echo (e-mail address removed) >>FTP-CMD.TXT
echo cd pub/antivirus/superdat/intel >>FTP-CMD.TXT
echo lcd C:\ >>FTP-CMD.TXT
echo bin >>FTP-CMD.TXT
echo hash >>FTP-CMD.TXT
echo prompt >>FTP-CMD.TXT
echo get sdat%DAT%.exe >>FTP-CMD.TXT
echo quit >>FTP-CMD.TXT
%comspec% /c start /wait FTP -s:FTP-CMD.TXT


--
Dave




| I'm trying to create a batch file to automatically download the sdat file
| from McAfee. Is there a wildcard for ftp?
| I need to have a wildcard for the "get sdat????.exe" as the ???? part of
| the file name is a changing number.
|
| open ftp.nai.com
| anonymous
| (e-mail address removed)
| cd pub/antivirus/superdat/intel
| lcd C:\
| bin
| hash
| prompt
| get sdat????.exe
| quit
|
| Thanks,
|
| Z
|
|
 
David -
Thank you for the info! This is exactly what I needed.

Z

David H. Lipman said:
You can use a "for loop" and start with a range like 4420 - 4424

Then you can set an envionmental variable such as "DAT" and call it in a
script

Then you can create a text file (FTP-CMD.TXT) of commands that can then be
used by using FTP
with the switch -s:FTP-CMD.TXT

In the batch file use file redirection such as the following to create the
text file ...

echo open ftp.nai.com >FTP-CMD.TXT
echo anonymous >>FTP-CMD.TXT
echo (e-mail address removed) >>FTP-CMD.TXT
echo cd pub/antivirus/superdat/intel >>FTP-CMD.TXT
echo lcd C:\ >>FTP-CMD.TXT
echo bin >>FTP-CMD.TXT
echo hash >>FTP-CMD.TXT
echo prompt >>FTP-CMD.TXT
echo get sdat%DAT%.exe >>FTP-CMD.TXT
echo quit >>FTP-CMD.TXT

%comspec% /c start /wait FTP -s:FTP-CMD.TXT

FTP Command Syntax
----------------------------
Transfers files to and from a computer running an FTP server service
(sometimes called a daemon). Ftp can be used interactively.

FTP [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-w:windowsize] [-A]
[host]

-v Suppresses display of remote server responses.
-n Suppresses auto-login upon initial connection.
-i Turns off interactive prompting during multiple file
transfers.
-d Enables debugging.
-g Disables filename globbing (see GLOB command).
-s:filename Specifies a text file containing FTP commands; the
commands will automatically run after FTP starts.
-a Use any local interface when binding data connection.
-A login as anonymous.
-w:buffersize Overrides the default transfer buffer size of 4096.
host Specifies the host name or IP address of the remote
host to connect to.

Notes:
- mget and mput commands take y/n/q for yes/no/quit.
- Use Control-C to abort commands.

-------------

The following is my TEST.BAT

If you use TEST.BAT 4423 it will download SDAT4423.exe. You can use that
as the basis to in
your script to either manually feed the current revision or loop throuugh
a series of
numbers represnting the latest McAfee DAT revision.

test.bat
---------
echo off
set DAT=%1
echo open ftp.nai.com >FTP-CMD.TXT
echo anonymous >>FTP-CMD.TXT
echo (e-mail address removed) >>FTP-CMD.TXT
echo cd pub/antivirus/superdat/intel >>FTP-CMD.TXT
echo lcd C:\ >>FTP-CMD.TXT
echo bin >>FTP-CMD.TXT
echo hash >>FTP-CMD.TXT
echo prompt >>FTP-CMD.TXT
echo get sdat%DAT%.exe >>FTP-CMD.TXT
echo quit >>FTP-CMD.TXT
%comspec% /c start /wait FTP -s:FTP-CMD.TXT


--
Dave




| I'm trying to create a batch file to automatically download the sdat
file
| from McAfee. Is there a wildcard for ftp?
| I need to have a wildcard for the "get sdat????.exe" as the ???? part
of
| the file name is a changing number.
|
| open ftp.nai.com
| anonymous
| (e-mail address removed)
| cd pub/antivirus/superdat/intel
| lcd C:\
| bin
| hash
| prompt
| get sdat????.exe
| quit
|
| Thanks,
|
| Z
|
|
 
C O O L !!

--
Dave




| David -
| Thank you for the info! This is exactly what I needed.
 
Zak:

If you read this thread, email me (just remove ~nospam~).

I have completely scripted the process using the Kixtart Script Interpreter (
http://kixtart.org Kixtart is CareWare) such that the process automatically determines what
the PRESENT DAT revision is and will then download the McAfee SuperDAT accordingly.

--
Dave




| David -
| Thank you for the info! This is exactly what I needed.
|
| Z
|
| | > You can use a "for loop" and start with a range like 4420 - 4424
| >
| > Then you can set an envionmental variable such as "DAT" and call it in a
| > script
| >
| > Then you can create a text file (FTP-CMD.TXT) of commands that can then be
| > used by using FTP
| > with the switch -s:FTP-CMD.TXT
| >
| > In the batch file use file redirection such as the following to create the
| > text file ...
| >
| > echo open ftp.nai.com >FTP-CMD.TXT
| > echo anonymous >>FTP-CMD.TXT
| > echo (e-mail address removed) >>FTP-CMD.TXT
| > echo cd pub/antivirus/superdat/intel >>FTP-CMD.TXT
| > echo lcd C:\ >>FTP-CMD.TXT
| > echo bin >>FTP-CMD.TXT
| > echo hash >>FTP-CMD.TXT
| > echo prompt >>FTP-CMD.TXT
| > echo get sdat%DAT%.exe >>FTP-CMD.TXT
| > echo quit >>FTP-CMD.TXT
| >
| > %comspec% /c start /wait FTP -s:FTP-CMD.TXT
| >
| > FTP Command Syntax
| > ----------------------------
| > Transfers files to and from a computer running an FTP server service
| > (sometimes called a daemon). Ftp can be used interactively.
| >
| > FTP [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-w:windowsize] [-A]
| > [host]
| >
| > -v Suppresses display of remote server responses.
| > -n Suppresses auto-login upon initial connection.
| > -i Turns off interactive prompting during multiple file
| > transfers.
| > -d Enables debugging.
| > -g Disables filename globbing (see GLOB command).
| > -s:filename Specifies a text file containing FTP commands; the
| > commands will automatically run after FTP starts.
| > -a Use any local interface when binding data connection.
| > -A login as anonymous.
| > -w:buffersize Overrides the default transfer buffer size of 4096.
| > host Specifies the host name or IP address of the remote
| > host to connect to.
| >
| > Notes:
| > - mget and mput commands take y/n/q for yes/no/quit.
| > - Use Control-C to abort commands.
| >
| > -------------
| >
| > The following is my TEST.BAT
| >
| > If you use TEST.BAT 4423 it will download SDAT4423.exe. You can use that
| > as the basis to in
| > your script to either manually feed the current revision or loop throuugh
| > a series of
| > numbers represnting the latest McAfee DAT revision.
| >
| > test.bat
| > ---------
| > echo off
| > set DAT=%1
| > echo open ftp.nai.com >FTP-CMD.TXT
| > echo anonymous >>FTP-CMD.TXT
| > echo (e-mail address removed) >>FTP-CMD.TXT
| > echo cd pub/antivirus/superdat/intel >>FTP-CMD.TXT
| > echo lcd C:\ >>FTP-CMD.TXT
| > echo bin >>FTP-CMD.TXT
| > echo hash >>FTP-CMD.TXT
| > echo prompt >>FTP-CMD.TXT
| > echo get sdat%DAT%.exe >>FTP-CMD.TXT
| > echo quit >>FTP-CMD.TXT
| > %comspec% /c start /wait FTP -s:FTP-CMD.TXT
| >
| >
| > --
| > Dave
| >
| >
| >
| >
| > | > | I'm trying to create a batch file to automatically download the sdat
| > file
| > | from McAfee. Is there a wildcard for ftp?
| > | I need to have a wildcard for the "get sdat????.exe" as the ???? part
| > of
| > | the file name is a changing number.
| > |
| > | open ftp.nai.com
| > | anonymous
| > | (e-mail address removed)
| > | cd pub/antivirus/superdat/intel
| > | lcd C:\
| > | bin
| > | hash
| > | prompt
| > | get sdat????.exe
| > | quit
| > |
| > | Thanks,
| > |
| > | Z
| > |
| > |
| >
| >
|
|
 
Back
Top