fsFileGetWild

Downloads one or more file from an FTP server.

Syntax:

fsFileGetWild( client-handle, server-wild, local-dir )

Parameters:

(s) client-handle: FTPS extender client handle.

(s) server-wild: server file name wildcard match pattern.

(s) local-dir: directory path to directory to place download files

Returns:

(i)@True(1) on success

Use this function to downloads multiple server files with names matching a wildcard pattern. The function does not error when no match files are found on the server.

 

client-handle

FTPS extender client handle obtain by a call to the fsClientInit function.

 

server-wild 

Use this parameter to specify the FTP server  file name wildcard pattern. The parameter must include the path to the directory to search but wildcards cannot be used in directory names.

 

The parameter support the following curl command line tool style wildcard match patterns:

 

Pattern

Examples

Description

*

(Max 2)

some/path/*.txt

Matches all .txt files in the path directory

?

some/path/image?.jpg

 Matches any (exactly one) character.

[ ]

[a-zA-Z0-9] - character interval
[abc] - character enumeration
[^abc] or [!abc] - negation
[[:name:]] class expression with class names  alnum, lower, space, alpha, digit, print, upper, blank, graph, or xdigit.
[][-!^] matches '-', ']', '[', '!' or '^'.
[[]] matches '[' or ']'

 Each bracket expression matches one character.

 

local-dir

Use to indicate the local directory to store the files that match the pattern in the server-wild  parameter.

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
  fmask = "\CustData\*.csv"
  ldir = "customers\"
  
  ; Get count of existsing files
  prev = ItemCount(FileItemize(DirScript():ldir:"*.csv"), @tab)
  
  ; Download any file that mask
  fsFileGetWild(client, fmask, ldir)
  
  ; Disconnect and remove from cache
  fsClientDelete(client)
  
  cur = ItemCount(FileItemize(DirScript():ldir:"*.csv"), @tab) 
  
  Message("Download Check", "Files added: ": cur-prev) 
  Exit  
See Also:

fsClientInit, fsFileGet, fsFileInfo, fsFilePut