Archive

Posts Tagged ‘ftp’

how to script an FTP upload in a BAT file

In several projects you have the need to automate your deployment procedures… unfortunately often your code is hosted by an external provider that for security reasons give you the access only with FTP…

This code is perfect to automate the upload of your deployment package.

1) Create a Bat File with the following code and name it Upload.bat

@echo off
echo user FTPUserName> ftpcmd.dat
echo FTPPWD >> ftpcmd.dat
echo cd FolderName >>ftpcmd.dat
echo bin>> ftpcmd.dat
echo put %1>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat FTPserverURL
del ftpcmd.dat

as you can understand you have to put into your username and password and eventually the code to switch directory if you are going to upload something on the root…

2) call your bat file with the following syntax: upload.bat testFile.zip

Happy scripting to everybody Smile

Categories: DEV, Infrastructure Tags: ,