I want to create a batch file to execute below commands -
- cd to the directory whose content i want to upload.
- log into the Ftp with Host name + userid & pswd
- Cd to the directory [in server] where you want to upload the files.
- mput *.txt
I am able to run these steps and transferred all the files to server location manually.
But now i want to automate the process, below is code of my batch file..but its giving error Invalid command - even though i have added linebreak after usernamevalue. i referred to How to script FTP upload and download?
i use below script - and its says "password required for user1" although i have given password
@echo off
echo user user1> ftpcmd.dat
echo mypassword>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat myservername
del ftpcmd.dat
pause
also first i have to change the directory to the location from where i am picking all the files [source folder of my files]
Something like CD c:\MySource