0

I have a batch file that ftps a load of txt file across to a different server.

My Original batch file was as follows:

@echo off
echo user MyUser> ftpcmd.dat 
echo MyPassWord>> ftpcmd.dat 
echo bin>> ftpcmd.dat 
echo lcd C:\MyFolder>>ftpcmd.dat 
echo mput *.txt>> ftpcmd.dat 
echo quit>> ftpcmd.dat ftp -i -n -s:ftpcmd.dat [ServerIP] 
del ftpcmd.dat 
del C:\MyFolder\*.txt

We are using Filezilla and when this runs we now get an error:

This server does not allow plain FTP. You have to use FTP over TLS

Having found this post: Secure FTP using Windows batch script

I updated the batch file to

@echo off
echo open ftpes://MyUser:MyPassword@[ServerIP] >> ftpcmd.dat
echo bin>> ftpcmd.dat
echo lcd C:\MyFolder>>ftpcmd.dat
echo mput *.txt>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -i -n -s:ftpcmd.dat [SERVERIP]
del ftpcmd.dat
del C:\MyFolder\*.txt

This gives the errors:

Already connected to [ServerIP], use disconnect first

Please log in with USER and PASS first

I know I have lost my way somewhere and quite possibly misinterpreting the other post but I'm not sure quite what I'm doing wrong. I don't think the two errors are related (although they may be) so I think the main question is

How do I login with USER and PASS first?

Community
  • 1
  • 1
Bex
  • 4,898
  • 11
  • 50
  • 87
  • The first part of the error seems to imply you need to execute a specific `disconnect` command at the end of your script before quitting. I heard about that before; otherwise you need to wait for the connection to time out. – Nyerguds Jul 06 '17 at 07:47
  • Windows `ftp.exe` DOES NOT support FTPS. You have to use a 3rd party FTP client (or PowerShell script). The [accepted answer to the question you have found yourself](https://stackoverflow.com/a/16151814/850848), shows how to use WinSCP (the `open ftpes://MyUser:MyPassword@[ServerIP]` is WinSCP syntax.) – Martin Prikryl Jul 07 '17 at 15:19

0 Answers0