Nubie Posted May 17, 2014 Share Posted May 17, 2014 I'm trying make FTP downloader my list files. but it only work well on first file then it stop. What wrong with me. Please help ! #include <FTPEx.au3> #include <File.au3> $file2 = @ScriptDir & "\file_download.txt" Local $sServer = 'ftp.mysite.com' Local $sUsername = 'user' Local $sPass = 'pass' If FileExists($file2) Then ProgressOn("Verify & Update", "Downloading", "Working") Local $iCountLines2 = _FileCountLines($file2) Local $hInternetSession = _FTP_Open('MyFTP') Local $hFTPSession = _FTP_Connect($hInternetSession, $sServer, $sUsername, $sPass, 1) for $b=1 to $iCountLines2 Local $sFileRead2 = FileReadLine($file2, $b) MsgBox(0,"",$sFileRead2) _FTP_ProgressDownload($hFTPSession, @ScriptDir & $sFileRead2, $sFileRead2) $count_do2 = $b *100 / $iCountLines2 ProgressSet($count_do2, Round($count_do2) & "%") next _FTP_Close($hInternetSession) FileDelete($file2) EndIf ProgressSet(100, "Done!") Sleep(750) ProgressOff() Exit Link to comment Share on other sites More sharing options...
abberration Posted May 18, 2014 Share Posted May 18, 2014 I haven't tested this theory, but it seems to me that you need to move your _FTP_ProgressDownload line to right before the For...Next loop. I think on each loop, you are creating a new version of it and the ProgressSet is not setting the percentage on topmost one. Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
mikell Posted May 18, 2014 Share Posted May 18, 2014 You should better use _FTP_FileGet, much easier for $b=1 to $iCountLines2 Local $sFileRead2 = FileReadLine($file2, $b) ; MsgBox(0,"",$sFileRead2) _FTP_FileGet($hFTPSession, $sFileRead2, @ScriptDir & "\" & $sFileRead2) $count_do2 = $b *100 / $iCountLines2 ProgressSet($count_do2, Round($count_do2) & "%") ; Sleep(1000) next Link to comment Share on other sites More sharing options...
Nubie Posted May 19, 2014 Author Share Posted May 19, 2014 Thanks mikell ! I know _FTP_FileGet. Here's my way was worked before. If FileExists($file2) Then ProgressOn("Verify & Update", "Download", "Starting...") $iCountLines2 = _FileCountLines($file2) $hInternetSession = _FTP_Open('XYZ Updater') $hFTPSession = _FTP_Connect($hInternetSession, $sServer, $sUsername, $sPass, 1) for $b=1 to $iCountLines2 $sFileRead2 = FileReadLine($file2, $b) $count_do2 = $b *100 / $iCountLines2 ProgressSet($count_do2, Round($count_do2) & "%") _FTP_FileGet($hFTPSession, $sFileRead2, @ScriptDir & $sFileRead2) next _FTP_Close($hInternetSession) FileDelete($file2) EndIf But I found _FTP_FileGet and _FTP_ProgressDownload will not work if Path on cilent didn't exist (folders). I don't know is it bug or not Link to comment Share on other sites More sharing options...
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