I'm usually more interested in event based programming/scripting, then schedule based. I had some requirements:
- Command line based,
- All info must be passable in a single command
- Parallel transfers to take full use of bandwidth.
Run this program when a torrent finishes:
C:\Utils\Scripts\ftp.vbs %K "%D" "%N" %L "%F"
ftp.vbs:
Dim path,label,cmd,nm,file,tp,host,user,pass,dir,drive,login,lftp,wd, context
host = "myHostOrIP"
user = "myUsername"
pass = "myPassword"
login = user & ":" & pass & "@" & host
lftp = "C:\Utils\lftp\lftp.exe"
wd = "C:\"
tp = WScript.Arguments.Item(0) 'single/multi
dir = WScript.Arguments.Item(1)
drive = LCase(Mid(dir, 1, 1))
path = "/cygdrive/" & drive & Right(dir,Len(dir)-2)
path = Replace(Replace(path,"\","/")," ","\ ")
nm = Replace(Replace(WScript.Arguments.Item(2),"\","/")," ","\ ")
file = path & "/" & Replace(Replace(WScript.Arguments.Item(4),"\","/")," ","\ ")
label = WScript.Arguments.Item(3)
If tp = "single" Then
context = "cd /" & label & "; put " & file
Else
'multifile
context = "mirror -R -v --parallel=3 --depth-first " & path & " /" & label & "/" & nm
End If
cmd = "ftp://" & login & " -e " & chr(34) & "set ftp:nop-interval 1; set net:timeout 5; "& context & "; quit" & chr(34)
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute lftp, cmd, wd, "runas", 1
Set objShell = Nothing
Note: This solution requires that you have a FTP Server running on your home computer. FileZilla for example.
Ingen kommentarer:
Legg inn en kommentar