Mit folgendem FTP Script greife ich auf meine Fritz Box zu.
Code: Select all
#Persistent
SetWorkingDir %A_ScriptDir%
startZeit := A_TickCount
FTPCommandFile = FTPCommands.txt
FTPLogFile = FTP.log
FileAppend,
(
open xxxxxxxxxxxxxx.myfritz.net
username
passwort
cd "/JMicron-Generic-01/TMP-Test-Verzeichnis"
dir
binary
get "220304_abgezockt_container_skandal_inf_3360k_p36v15.mp4"
bye
), %FTPCommandFile%
Run, cmd /k ftp -s:%FTPCommandFile% > %FTPLogFile%,,Hide
Process, wait, cmd.exe
PID := ErrorLevel
if PID
setTimer, Fertig, -1
return
Fertig:
If FileExist(FTPLogFile) {
FileRead thisLog,% FTPLogFile
if thisLog contains 221 Goodbye
{
Filedelete, %FTPCommandFile%
FormatTime, TimeStamp,% a_now, dd.MM.yyyy HH-mm-ss tt
FileMove,% FTPLogFile,% TimeStamp " - " FTPLogFile
Process, Close, %PID%
EndZeit := (A_TickCount - StartZeit) / 1000
FileAppend,% "`nDownloadZeit:`t" round(EndZeit) " Sekunden",% TimeStamp " - " FTPLogFile
exitapp
}}
setTimer, Fertig, -100
return
Das läuft auch alles wie gedacht. Nun möchte ich es durch eine GUI erweitern. Dabei sollen die via Dir Befehl angezeigten Files in einem ListView angezeigt werden.
Um die FileNamen zu bekommen plane ich so vorzugehen:
Code: Select all
;FileRead, logFile, ftp.log
logFile := "-rwxrwxrwx 1 ftp ftp 863293667 Apr 10 20:44 220304_abgezockt_container_skandal_inf_3360k_p36v15.mp4`n"
logFile .= "-rwxrwxrwx 1 ftp ftp 0 Apr 11 04:51 test eins zwei drei vier fünf sechs sieben.txt`n"
logFile .= "-rwxrwxrwx 1 ftp ftp 0 Apr 11 04:51 a b c d e f g.xlsx`n"
loop, parse, logFile, "`n", "`r"
{
if a_loopfield contains -rwxrwxrwx
{
split := strSplit(a_loopfield, a_space)
resultat .= split[9] a_space
. split.10 a_space
. split.11 a_space
. split.12 a_space
. split.13 a_space
. split.14 a_space
. split.15 a_space
. split.16 a_space
. split.17 "`n"
. ((split.length())-8) "`n"
}
}
MsgBox,,% A_LineNumber,% resultat "`n"
Wie bekomme ich den FileNamen ohne schätzen heraus?
Ich brauche alle Wörter nach split[8]