Advertisement
Guest User

Untitled

a guest
Jun 11th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. @ECHO OFF
  2. REM ## Windows batch script to upload of one file passed as parameter using Windows FTP client
  3.  
  4. REM ## Modify the following variables as you wish
  5. SET FTP_SERVER=
  6. SET FTP_USER=
  7. SET FTP_PASSWORD=
  8.  
  9. REM ## Test if can proceed
  10. SET FILE_NAME=%1
  11. IF "%FILE_NAME%"=="" GOTO :ERR_BLANK
  12. IF NOT EXIST %FILE_NAME% GOTO :ERR_NOTEXIST
  13.  
  14. REM ## Upload via scripted Windows FTP Client. Delete local file at the end.
  15. ECHO user %FTP_USER%> upload.dat
  16. ECHO %FTP_PASSWORD%>> upload.dat
  17. ECHO bin>> upload.dat
  18. ECHO put %FILE_NAME%>> upload.dat
  19. ECHO quit>> upload.dat
  20. type upload.dat
  21. ftp -n -s:upload.dat %FTP_SERVER%
  22. REM If you want to delete file after transfer, use DEL %FILE_NAME% - be carefull, there isn't confirmation the file was successfully uploaded
  23.  
  24. REM ## Remove temporary files
  25. DEL upload.dat
  26. GOTO :EOF
  27.  
  28. :ERR_BLANK
  29. ECHO Please, provide the file name to upload as parameter.
  30. GOTO :EOF
  31.  
  32. :ERR_NOTEXIST
  33. ECHO File %1 does not exist! Nothing to upload.
  34. GOTO :EOF
  35.  
  36. :EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement