David
David

Reputation: 35

Cannot connect to ftp - batch file

I have simple batch file to copy multiple files to FTP. I tried many things, but in dir.txt i see, that I am not at FTP server, but in Local directory. Why i cannot to start ftp? :)

I have 2 files:

first.bat

upload.bat > log.txt
ftp -i -s:upload.bat

upload.bat

open myftp.myadress.com
name
password
dir >> dir.txt
cd testfolder
cd cielovy
prompt
bin
mput C:\Users\MyUser\Desktop\FTPtest\upload\*
bye

Thanks :)


After editing batch files and run, it wrotes: cmd.exe image

Upvotes: 0

Views: 550

Answers (1)

user7818749
user7818749

Reputation:

You are running a batch file to log the commands to a file log.txt, but you are calling the batch file from ftp.

instead try this:

"C:\Users\MyUser\Desktop\FTPtest\upload.bat" > log.txt
cd "C:\Users\MyUser\Desktop\FTPtest\upload"
ftp -i -s:"C:\Users\MyUser\Desktop\FTPtest\log.txt"

Secondly, your batch file is wrong. If you want to create a file for ftp -I to read you need to ensure that the commands are piped to the file for instance everything should pipe, currently you are running the commands and piping the output to log.txt

echo open myftp.myadress.com
echo name
echo password
echo dir >> dir.txt  # This however will not do what you think it would.
echo cd testfolder
echo cd cielovy
echo prompt
echo bin
echo mput *
echo bye

Upvotes: 1

Related Questions