Downloads a file from an FTP server.
fsFileGet( client-handle, server-file [, local-file] )
(s) client-handle: FTPS extender client handle.
(s) server-file: name of server file (with path as needed) to download.
(s) local-file: (optional) name of the local file with optional path information.
(i)@True(1) on success
The fsFileGet function downloads a server file to a storage location available to the computer running the script.
client-handle
FTPS extender client handle obtain by a call to the fsClientInit function.
server-file
Use this parameter to specify the FTP server file you wish to download. Include any necessary server path information to the targeted file so that the correct file receives the uploaded data.
local-file
Use this optional parameter to indicated the local file name and location on the local computer.
The function exhibits the following behaviors based on the parameter's existence and content:
If the parameter includes directory path information, the directory path must already exist on the local computer. The function will not create the path for you.
If path information is not contained with the file name, file is download to the current-working-directory of the process executing the script.
If the parameter is set to an empty string, the server file name and path is used. However, the function does not create a local path to match the server file's path so the path must already exist on the local computer.
If the parameter is not specified, the function downloads the server file to the current-working-directory of the process executing the script using the file name from the function's server-file parameter.
AddExtender('ilcfs44i.dll',0,'ilcfs64i.dll') host = 'test.example.com' port = 21 user = 'demo' pswd = 'password' text = 'Download failed' ; Create a client client = fsClientInit(host, port, user, pswd) ; Get searchable array of file dir = "\CustData" file = "Customers.csv" files = fsDirList(client, dir, @fsArray) i = Arraysearch(files, file, 2) ; Download the file to CWD using server's file name If i > -1 fsFileGet(client, dir:'/':files[i]) If FileExist(files[i]) Then text = files[i]:' - Download succeeded' EndIf Message("FTPS File Download", text) ; Disconnect and remove fsClientDelete(client)
fsDirList, fsClientInit, fsFileInfo, fsFileGetWild, fsFilePut