Create a batch file like this:
@echo off
echo USERNAME> upload.txt
echo PASSWORD>> upload.txt
echo asc>>upload.txt
echo put UPLOAD_FILE_NAME FTP_PATH_TO_STORE_FILE>> upload.txt
echo quit >> upload.txt
ftp -s:upload.txt SERVER_NAME.COM
del upload.txt
UPLOAD_FILE_NAME
: - you can store file to be uploaded in the same directory where the batch file exists or give file name with absoulte path.I.e I need to upload a file called register.exe
I should use
echo put register.exe
, If register.exe
is exists in the batch directory or
echo put d:\myfiles\register.exe, If register.exe
is exists in another folder(myfiles folder in d drive)
FTP_PATH_TO_STORE_FILE
:- This is the FTP path where I need to put my file.For example /home/myftpfolder/register.exe
del upload.txt
:- its optional because when executes batch file this upload.txt
will stores in the directory with FTP username and password
If I've my server name is theserver.com
then the batch file should be write like
@echo off
echo user123> upload.txt
echo 123TTyyy#>> upload.txt
echo asc>>upload.txt
echo put register.exe /home/myfiles/register.exe>> upload.txt
echo quit >> upload.txt
ftp -s:upload.txt theserver.com
del upload.txt