Need Help Throttling Downloads From an FTP Site

Jim Lambert jiml at netrin.com
Mon Sep 21 21:07:22 EDT 2015


Gregory,

Try this (untested):

local lListOfFilePaths

on downloadAll
	put theListofFiles into lListOfFilePaths
	getnextFile
end repeat

on getNextFile
	if lListOfFilePaths = empty then exit getNextFile	
	put line 1 of lListOfFilePaths into remoteFilePath
	—SET THE LOCAL FILE’S NAME HOWEVER YOU NORMALLY WOULD
	put whatever into localFileName
	libURLDownloadToFile ("ftp://anonymous:myEmailAddress@ftp.sec.gov/" & remoteFilePath),(exportFolderPath & "/" & localFileName ),"downloadComplete"
end getNextFile


command downloadComplete pURL, pStatus
    if pStatus = "error" or pStatus = "timeout" then
        answer error "The file” && pURL && "could not be downloaded."
    else
 	getNextFile
    end if
end downloadComplete


Basically it fetches the files one at a time.
No need for adding guessed-at delays.

Jim Lambert



More information about the use-livecode mailing list