简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM