Reputation:
Following various guides around the net, I put together a batch file that should upload a .zip to our central file server. However, If I use "ftp -n -s:ftpup.dat 108.174.61.82 20" it doesn't work with the port 20 added to the host. I have also tried "ftp -n -s:ftpup.dat" then "open 108.174.61.82 20" on the next line which also fails. What exactly am I doing wrong?
cd MySQL
@echo off
echo user backups>ftpup.dat
echo passwordhere>>ftpup.dat
echo cd /MySQL>>ftpup.dat
echo binary>>ftpup.dat
echo put MYSQL-%location%.%backuptime%.zip>>ftpup.dat
echo quit>>ftpup.dat
ftp -n -s:ftpup.dat serveriphere 20
del ftpup.dat
Upvotes: 0
Views: 5549
Reputation: 2363
I know this is an old question, but I had the same problem with the port, this is what worked for me, I saved the command open %ftphost% > ftpcmd.dat
in the file instead of calling it later
SET ftphost=172.xxx.xxx.xx 22
ECHO open %ftphost% > ftpcmd.dat
ECHO user %username%>> ftpcmd.dat
ECHO %userpass%>> ftpcmd.dat
ECHO bin>> ftpcmd.dat
ECHO put %file%>> ftpcmd.dat
ECHO quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat
del ftpcmd.dat
Upvotes: 1
Reputation: 11063
Are you running FTP server or port 20?
Telnet serveriphere 20 to check if the port is listening, maybe you have it running on default port 21
PS: Is it raw ftp protocol?. Maybe It is using SFTP or FTPS
EDIT: Try with
ftp -s:ftpup.dat serveriphere 20
Remove the -n autologin flag
Try with this:
Echo ~UsrName~> ftpcmd.txt
echo ~myPass~>> ftpcmd.txt
echo binary>> ftpcmd.txt
echo prompt n>>ftpcmd.txt
echo mget *.exe>> ftpcmd.txt
echo bye >> ftpcmd.txt
ftp -s:ftpcmd.txt ~ftpAddress~
del ftpcmd.txt
Upvotes: 1