FTP Server mit einem Batch im Kreis testen

checke-ftp-server

Mit diesem Batch kann man einen FTP Server richtig quälen und fortlaufend eine Datei hochladen.

timeout /T [Sekunden] /NOBREAK

checke-ftp-server.cmd

@echo off
:start
echo GO!
echo ######################-%date% - %time:~0,8%>>.\ftp.log
ftp -d -s:ftpbefehle1.txt>>.\ftp.log
timeout /T 4 /NOBREAK
goto start

ftpbefehle1.txt

server
Benutzer
Passwort

open vosftp01.wmg.loc
zgttest
ZGT4lan
put testdatei.txt
bye

Wenn der passive Modus gewünscht wird dann

open vosftp01.wmg.loc
zgttest
ZGT4lan
quote pasv
put testdatei.txt 
bye

Ergänzend:

Many people just have this wrong notion that windows command line FTP.exe can not be run in passive mode. It actually can be configured to run. The (undocumented or not well documented in ftp help) QUOTE command is the key here. QUOTE PASV command will set the FTP client to work in passive mode. Below is an example:

ftp>open
userid:
password:
ftp>quote pasv
ftp>binary
ftp>put
ftp>quit

To run a sequence of FTP command from a file you may use Batch command or VBScript. First create your ftp command file (say ftp.txt) in note pad. The content of the file would be as below. Replace the fields with in [] with appropriate values:

open [siteaddress.com]
[userid]
[password]
quote pasv
binary
put
quit

Simply write the following in a batch file (say ftp.bat) to execute the ftp.txt content:

c:\windows\system32\ftp.exe -s:c:\ftp.txt

If you want to use VBScript, create a VBScript file (say ftp.vbs) in notepad as well. The content of the script file would be as below:

Set objShell = CreateObject("WScript.Shell")
objShell.Run "c:\windows\system32\ftp.exe -s:c:\ftp.txt", , True
Set objShell = Nothing