Jewtus Posted October 6, 2016 Posted October 6, 2016 I've been trying to figure out the ftp UDF but it doesn't seem to work for me, so I started looking at some other alternatives that are supposed to work with ftp. I'm using the Mozilla FTP as a test URL but I can't seem to get this script to actually download the file to the local machine. Am I doing something wrong? GetfromFTP("ftp.mozilla.org/bundles/msn/us/win32/en-US/Firefox%20Setup.exe") Func GetfromFTP($sURL,$sUsername='',$sPassword='' ) local $sFilePath=@TempDir&"\",$digits=20,$fn,$aSpace[3] For $i=1 to $digits $aSpace[0]=Chr(Random(48,57,1));0-9 $aSpace[1]=Chr(Random(97,122,1));a-z $aSpace[2]=Chr(Random(65,90,1));A-Z $fn &= $aSpace[Random(0,2,1)] Next $sFilePath=$sFilePath&$fn&StringRight($sURL,4) If $sUsername='' AND $sPassword='' then InetGet("ftp://"&$sURL&"/", $sFilePath, 1) Else InetGet("ftp://"&$sUsername&":"&$sPassword&"@"&$sURL&"/", $sFilePath, 1) EndIf MsgBox(0,"",$sFilePath) FileDelete($sFilePath) EndFunc
genius257 Posted October 6, 2016 Posted October 6, 2016 I can't seem to access "ftp.mozilla.org" with a ftp protocol. I can however access it with http or https protocol. This works no problem for me: InetGet("https://ftp.mozilla.org/bundles/msn/us/win32/en-US/Firefox%20Setup.exe", @TempDir&"\") To show your appreciation My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser
Jewtus Posted October 6, 2016 Author Posted October 6, 2016 Well, that is odd. I tried your line of code and it executes without error, but no file is actually saved to the temp dir. I'm using Windows 10 (I don't know if that matters).
genius257 Posted October 6, 2016 Posted October 6, 2016 Sorry i changed the path to the one you were using. I believe you need to specify the filename also. So something like: @TempDir&"\file.exe" To show your appreciation My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser
Jewtus Posted October 6, 2016 Author Posted October 6, 2016 ... that should have be obvious to me... sorry Thanks! That does seem to work... Now I'll just have to try with SFTP...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now