ɹəuəllıʍ ʇɐb Posted May 19, 2005 Report Share Posted May 19, 2005 Every morning I download the newest McAfee DAT file and SuperDAT file to a local server for all users in my office. It used to be every week, but now new DAT files are made available every day. This is a good thing, but I'm getting tired of manually downloading these files every day.So I wrote a little BAT file that initiates FTP connects, etc., but it doesn't work!It does not take userid, password, and commands from the BAT script.Even if it did (I'm sure there is a way), it does not accept wildcards in the name, such as get dat*Any suggestions? Quote Link to comment Share on other sites More sharing options...
scuzzman Posted May 19, 2005 Report Share Posted May 19, 2005 Are you able to get the dat files via HTTP as opposed to FTP? If so, you could use wget. Quote Link to comment Share on other sites More sharing options...
ɹəuəllıʍ ʇɐb Posted May 19, 2005 Author Report Share Posted May 19, 2005 No, both ftp.nai.com and ftp.mcafee.com refuse http connections (just tried it). Quote Link to comment Share on other sites More sharing options...
ɹəuəllıʍ ʇɐb Posted May 19, 2005 Author Report Share Posted May 19, 2005 Downloaded it anyway, tested it with ftp, and it works anyway!Thanks, as always! :flowers: Quote Link to comment Share on other sites More sharing options...
ɹəuəllıʍ ʇɐb Posted May 23, 2005 Author Report Share Posted May 23, 2005 I need a little bit more help with this. I wrote a little batch script that I added to the task scheduler to run every morning:Z:cd \Install\AntiVirus\DATdel dat*del update.iniC:\PROGRA~1\wget\wgët ftp://ftp.mcafee.com/pub/datfiles/japanese/dat*C:\PROGRA~1\wget\wgêt ftp://ftp.mcafee.com/pub/datfiles/japanese/update.iniX:cd \jpnnyan\Install\AntiVirus\Superdat-Jdel sdat*del update.iniC:\PROGRA~1\wget\wgét ftp://ftp.mcafee.com/pub/datfiles/japanese/sdat*C:\PROGRA~1\wget\wgèt ftp://ftp.mcafee.com/pub/datfiles/japanese/update.iniexitThis works beautifully -- as long as the network is stable. This weekend it was not the case; so the script deleted the DAT files, but was unable to download a new one.Question: is there a way to test the return code of "wgėt" so that I could restore the DAT files if the download fails? Quote Link to comment Share on other sites More sharing options...
scuzzman Posted May 23, 2005 Report Share Posted May 23, 2005 Why not just back them up anyway? In your batch, copy them to a backup directory then replace them. I'm not sure (and I don't think so) if batch files support return codes. Quote Link to comment Share on other sites More sharing options...
ɹəuəllıʍ ʇɐb Posted May 23, 2005 Author Report Share Posted May 23, 2005 I was hoping that I could fully automate the process. If the download fails, then automatically restore the backed-up files.I will do some more reading on ŵģęť, and see if I can use IF ERRORLEVEL in the batch script. Quote Link to comment Share on other sites More sharing options...
scuzzman Posted May 23, 2005 Report Share Posted May 23, 2005 You may be more successful determining network stability with PING, as this might make things a little easier as it is incorporated and not a third-party application... Quote Link to comment Share on other sites More sharing options...
scuzzman Posted May 23, 2005 Report Share Posted May 23, 2005 I think I may have found it:here: http://goforit.unk.edu/msdos/msdos19.htm Quote Link to comment Share on other sites More sharing options...
ɹəuəllıʍ ʇɐb Posted May 23, 2005 Author Report Share Posted May 23, 2005 Tested, and ŵģęť returns 1 if the operation fails. My new script:Z:cd \Install\AntiVirus\DATdel BACKUP\dat*del BACKUP\update.inimove dat* BACKUPmove update.ini BACKUPC:\PROGRA~1\wget\wgėt ftp://ftp.mcafee.com/pub/datfiles/japanese/dat*if errorlevel 1 copy /Y BACKUP\dat*C:\PROGRA~1\wget\wgėt ftp://ftp.mcafee.com/pub/datfiles/japanese/update.iniif errorlevel 1 copy /Y BACKUP\update.iniX:cd \jpnnyan\Install\AntiVirus\Superdat-Jdel BACKUP\sdat*del BACKUP\update.inimove sdat* BACKUPmove update.ini BACKUPC:\PROGRA~1\wget\wgėt ftp://ftp.mcafee.com/pub/datfiles/japanese/sdat*if errorlevel 1 copy /Y BACKUP\sdat*C:\PROGRA~1\wget\wgėt ftp://ftp.mcafee.com/pub/datfiles/japanese/update.iniif errorlevel 1 copy /Y BACKUP\update.iniexitThanks for the help! :)Updated script to eliminate confirmation prompt from del *.* Quote Link to comment Share on other sites More sharing options...
scuzzman Posted May 23, 2005 Report Share Posted May 23, 2005 Great job! And thanks for posting the script (could be useful to someone else in the future -- this could be very useful for incremental backups! Quote Link to comment Share on other sites More sharing options...
ɹəuəllıʍ ʇɐb Posted May 23, 2005 Author Report Share Posted May 23, 2005 Anybody using part of the script, don't forget to replace the doctored 'e' in wgėt (see topic 19065). :ninja: Quote Link to comment Share on other sites More sharing options...
ɹəuəllıʍ ʇɐb Posted May 26, 2005 Author Report Share Posted May 26, 2005 Here is the final script, now that it's completely tested and everything works as expected.rem ------------------------------rem Backup old, download new filesrem ------------------------------X:cd \jpnnyan\Install\AntiVirus\DATdel /Q BACKUP\dat*move dat* BACKUPC:\PROGRA~1\wget\wget.exe ftp://ftp.mcafee.com/pub/datfiles/japanese/dat*if errorlevel 1 copy /Y BACKUP\dat*del BACKUP\update.inimove update.ini BACKUPC:\PROGRA~1\wget\wget.exe ftp://ftp.mcafee.com/pub/datfiles/japanese/update.iniif errorlevel 1 copy /Y BACKUP\update.iniremrem ------------------------------rem Copy files to JPNNYAN locationrem ------------------------------del /Q Z:\Install\AntiVirus\DAT\dat*copy /Y dat* Z:\Install\AntiVirus\DATdel Z:\Install\AntiVirus\DAT\update.inicopy /Y update.ini Z:\Install\AntiVirus\DATremrem ------------------------------rem Backup old, download new filesrem ------------------------------X:cd \jpnnyan\Install\AntiVirus\Superdat-Jdel /Q BACKUP\sdat*move sdat* BACKUPC:\PROGRA~1\wget\wget.exe ftp://ftp.mcafee.com/pub/datfiles/japanese/sdat*if errorlevel 1 copy /Y BACKUP\sdat*del BACKUP\update.inimove update.ini BACKUPC:\PROGRA~1\wget\wget.exe ftp://ftp.mcafee.com/pub/datfiles/japanese/update.iniif errorlevel 1 copy /Y BACKUP\update.iniexit /B 0 Quote Link to comment Share on other sites More sharing options...
ɹəuəllıʍ ʇɐb Posted June 11, 2005 Author Report Share Posted June 11, 2005 This is as good as any place to announce that "wget" 1.10 has been released.See ftp://ftp.gnu.org/gnu/wget/; Windows executables are available from http://xoomer.virgilio.it/hherold/.Here is a list of changes for "wget" 1.10:http://xoomer.virgilio.it/hherold/News Quote Link to comment Share on other sites More sharing options...
ɹəuəllıʍ ʇɐb Posted August 18, 2005 Author Report Share Posted August 18, 2005 "wget" 1.10.1 has been released; see http://www.mail-archive.com/[email protected]/msg08075.html(But I haven't found any Windows executables of 1.10.1 yet). Quote Link to comment Share on other sites More sharing options...
ɹəuəllıʍ ʇɐb Posted October 21, 2005 Author Report Share Posted October 21, 2005 wget 1.10.2 has been released; it contains an important security fix. Anyone using 1.10 or 1.10.1 should upgrade to the latest version.AnnouncementOfficial website with download links.Version 1.10.2 for Windows is also available. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.