Command line FTP "Connection closed by remote host"

I am trying to connect to an FTP site using a .bat file and a .txt file as I am calling those from an application.
When I connect to the FTP site using Explorer I can transfer files with no problem. When I use the command line I get the "Connection closed by remote host" error.
This is my txt file that I use:
@echo off
open ftp.ftpsite.com 8021
username
password

prompt

cd INBOUND
quote pasv
mput ARScan.csv


The command line just sits after the mput for about 30 seconds and the errors.

Any ideas would be greatly received
Thanks
Iain
iainmacleodAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

KimputerCommented:
Actually, I would suggest to cut out the "quote pasv"
0
iainmacleodAuthor Commented:
I have tried without the "quote pasv" with the same result.
Reading the link it looks as though the issue is that Cpmmand Line FTP does not support passive mode, however it looks as though the session enters passive mode?? See Screen Shot. I run the same procedure to another FTP site with no problem so it must be something to do with the passive mode..?
FTP Command screen shot
0
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

KimputerCommented:
Yes, my answer was too quick. FTP.exe will actually not support passive mode no matter what commands you throw at it. You have to find an alternative (free from http://www.ncftp.com/).
While you use "quote pasv", the server side sees it, and replies it is entering Passive Mode. This does not mean the client knows anything about it though, that's why nothing happens.
0
AlexPaceCommented:
You could do it with Robo-FTP like this:
WORKINGDIR "c:\source\folder\"
FTPLOGON "ftp.ftpsite.com" /port=8021 /user="UserID" /pw="secret"
FTPCD "INBOUND"
IFERROR GOTO done   ;; don't upload if can't access INBOUND folder
SENDFILE "ARScan.csv" 
:done
FTPLOGOFF
EXIT

Open in new window


Anyway, if you saved that script as a file named SendScan.s you could launch Robo-FTP and have it run the script with a command like:
  robo-ftp.exe -v -s"SendScan.s"

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
iainmacleodAuthor Commented:
Thanks for the help and suggestion of NCftp but I could not seem to get that started.
AlexPace, the Robo FTP looks the way forward. I have managed to create the script that works when I run it from Robo-FTP itself but I cant get it using the command. The a screen just flashes up and then disappears.
I have tried in a bat file:
"C:\Program Files (x86)\Robo-FTP 3.9\robo-ftp.exe"  -v -s"SendScan.s"
0
iainmacleodAuthor Commented:
AlexPace, many thanks, I missed adding Robo-FTP to the path.
Thanks very much, spent some money on Robo-FTP but a good solution.
0
AlexPaceCommented:
I first got Robo-FTP for one specific project but then other automation needs started turning up and I've ended up using it for many projects over the years.  Scripting it is easier than writing a tiny custom app in Visual Studio plus the IT guys can support it on an ongoing basis because doing something like changing the server address or password does not require editing the source code and recompiling.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Internet Protocols

From novice to tech pro — start learning today.