1

I am trying to create a simple ftp batch file to upload a handful of files on a regular basis but I cannot seem to get the login right. I can take the same credentials and log in through Filezilla without issue but from the command line it's not working.

Here is what I am attempting:

ECHO Creating Script File for FTP Download for District %2....
ECHO open xxx.xxx.xxx.xxx >ftp.scr
ECHO myuser >>ftp.scr
ECHO mypassword >>ftp.scr
ECHO bin >>ftp.scr
ECHO send %1 >>ftp.scr
ECHO quit >>ftp.scr

ftp -s:ftp.scr

Simple and to the point I believe.

Here is what it is responding with:

D:\Suburban>ftp -s:ftp.scr
ftp> open xxx.xxx.xxx.xxx
Connected to xxx.xxx.xxx.xxx
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 5 of 50 allowed.
220-Local time is now 10:16. Server port: 21.
220 You will be disconnected after 15 minutes of inactivity.
User (xxx.xxx.xxx.xxx:(none)):
331 User myuser  OK. Password required

530 Login authentication failed
Login failed.
ftp> bin
200 TYPE is now 8-bit binary
ftp> send webtrn25.001
530 You aren't logged in
530 You aren't logged in
ftp> quit
221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
221 Logout.

I thought this should be straight forward, but seems nothing ever is... This has to be something simple I'm overlooking.

Any input would be greatly appreciated!

** EDIT **

Let me also add, if I run these commands straight up from the command line, I am able to log in via ftp:

D:\Suburban>ftp
ftp> open xxx.xxx.xxx.xxx
Connected to xxx.xxx.xxx.xxx
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 5 of 50 allowed.
220-Local time is now 10:19. Server port: 21.
220 You will be disconnected after 15 minutes of inactivity.
User (xxx.xxx.xxx.xxx:(none)): myuser
331 User myuser OK. Password required
Password:
230 OK. Current restricted directory is /
ftp>
2

I debated deleting this, the mods might still do so, but I figured out my issue. figured it might help someone later down the road...

ECHO myuser >>ftp.scr
ECHO mypassword >>ftp.scr

The space between the name/password and the >> was the issue.

Once I changed it to:

ECHO myuser>>ftp.scr
ECHO mypassword>>ftp.scr

It worked fine!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.