Posted By

pauliehaha on 07/08/09


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


Unattended FTP Batch Download


 / Published in: DOS Batch
 

  1. @echo off
  2.  
  3. SET SERVER=xxx.xxx.xxx.xxx
  4. SET USERNAME=xxxxxxxx
  5. SET PASSWORD=xxxxxxxx
  6. SET LOCALFILE=C:\LOGS
  7. SET REMOTEPATH=/LOGS
  8. SET REMOTEFILE=*.log
  9. SET LOGFILE=ftplog.txt
  10. SET TEMPFILE=$temp.txt
  11.  
  12. cd %LOCALFILE%
  13.  
  14. echo open %SERVER% >%TEMPFILE%
  15. echo %USERNAME%>>%TEMPFILE%
  16. echo %PASSWORD%>>%TEMPFILE%
  17. echo bin >>%TEMPFILE%
  18. echo cd %REMOTEPATH% >>%TEMPFILE%
  19. echo prompt >>%TEMPFILE%
  20. echo mget %REMOTEFILE% >>%TEMPFILE%
  21. echo quit >>%TEMPFILE%
  22.  
  23. echo. >>%LOGFILE%
  24. echo. >>%LOGFILE%
  25. echo Transfering %REMOTEFILE% to %LOCALFILE% at %DATE% %TIME% >>%LOGFILE%
  26.  
  27. REM Execute FTP script
  28. REM ------------------
  29.  
  30. ftp -s:%TEMPFILE% >>%LOGFILE%
  31.  
  32. REM Clean up
  33. REM --------
  34. del %TEMPFILE%

Report this snippet  

You need to login to post a comment.