Question

I must log in to multiple servers and upload some files. Is there a chance to code this with AutoIt?

I have tested it with an batch file, but doesn't work:

echo open < /FTP/ftphost.txt   
echo < /FTP/ftpuser.txt    
echo < /FTP/ftppass.txt    
echo cd C:\Dokumente und Einstellungen\Administrator\Desktop\FTP\dateien>>ftp.txt    
echo cd httpdocs>>ftp.txt     
echo mput test.txt test2.txt   
echo bye 

p in the ftphost.txt File should be the diffrent FTP Servers in the ftpuser.txt file the diffrent ftp users in the ftppass.txt file one password.

Was it helpful?

Solution

If you use a file with the FTP information like this (and each FTP server has the same folder structure)

FTPlist.txt

ftp.host1.com|username1|password1
ftp.host2.com|username2|password2
ftp.host3.com|username3|password3
ftp.host4.com|username4|password4

Then this batch file can upload the set of files to each FTP server:

@echo off
for /f "usebackq tokens=1,2,3 delims=|" %%a in ("FTPlist.txt") do (
(
echo.open %%a
echo.%%b
echo.%%c
echo.binary
echo.lcd "C:\Dokumente und Einstellungen\Administrator\Desktop\FTP\dateien"
echo.cd httpdocs
echo.mput test.txt test2.txt   
echo.bye 
) >ftp.script
ftp -i -s:ftp.script >> ftp.log
)
del ftp.script
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top