I'm trying to automate an ftp upload with a Batch script using the ftp -s:commandsfile.ftp
command, at first everything seems OK: ftp server sends welcome message, username is automatically introduced, but when ftp asks for a password, nothing is introduced and all other commands that commandsfile.ftp sends return a "530 You aren't logged in" error:
Connected to ns12.dnchosting.com.
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 5 of 50 allowed.
220-Local time is now 16:02. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
User (ns12.dnchosting.com:(none)):
331 User [USERNAME] OK. Password required
530 Login authentication failed
Login failed.
This is the commandsfile.ftp file:
open web12.dnchosting.com
[USERNAME]
[PASSWORD]
lcd
cd afolder
mkdir anotherfolder
mput "*.*"
disconnect
bye
And this the batch script:
ftp -i -s:commandsfile.ftp
Why is CMD not introducing the password?
Alright, problem solved... the ftp file had an extra space character at the end of each line, so that the password entered was the password plus an extra space because the ftp file is dynamically generated.