Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ECHO OFF
- REM ## Windows batch script to upload of one file passed as parameter using Windows FTP client
- REM ## Modify the following variables as you wish
- SET FTP_SERVER=
- SET FTP_USER=
- SET FTP_PASSWORD=
- REM ## Test if can proceed
- SET FILE_NAME=%1
- IF "%FILE_NAME%"=="" GOTO :ERR_BLANK
- IF NOT EXIST %FILE_NAME% GOTO :ERR_NOTEXIST
- REM ## Upload via scripted Windows FTP Client. Delete local file at the end.
- ECHO user %FTP_USER%> upload.dat
- ECHO %FTP_PASSWORD%>> upload.dat
- ECHO bin>> upload.dat
- ECHO put %FILE_NAME%>> upload.dat
- ECHO quit>> upload.dat
- type upload.dat
- ftp -n -s:upload.dat %FTP_SERVER%
- REM If you want to delete file after transfer, use DEL %FILE_NAME% - be carefull, there isn't confirmation the file was successfully uploaded
- REM ## Remove temporary files
- DEL upload.dat
- GOTO :EOF
- :ERR_BLANK
- ECHO Please, provide the file name to upload as parameter.
- GOTO :EOF
- :ERR_NOTEXIST
- ECHO File %1 does not exist! Nothing to upload.
- GOTO :EOF
- :EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement