fsFileGet

Downloads a file from an FTP server.

Syntax:

fsFileGet( client-handle, server-file [, local-file] )

Parameters:

(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.

Returns:

(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:

Example:
  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)       
See Also:

fsDirList, fsClientInit, fsFileInfo, fsFileGetWild, fsFilePut