fsDirList

Returns a list or array of a server directory's contents.

Syntax:

fsDirList( client-handle, server-path, return-type [, names-only] )

Parameters:

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

(s) server-path: full path including the name of the FTP server directory to list.

(s) return-type: either @fsArray or @fsList.

(s) names-only: [optional]  @True (default) to return just the content's names.

Returns:

(a/l) Array or list of a server directory's contents.

The function returns a listing of the contents of the targeted FTP server directory if it exists on the server and the indicated user has permission to list the contents of the directory. If the directory does not exist or the user does not permission to list the directory, the server may return an access denied error. However, the outcome of attempting to list a non-existent or not allowed directory is server dependent.

 

client-handle

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

 

server-path

The parameter indicates the FTP server full path to list. A directory contests list is similar but not exactly like the Linux command shell "ls" command or the Windows command shell "dir" command.

 

return-type

Use the parameter to indicate if the directory contents listing is returned as a line-feed character delimited list or WIL array. Use the extender constant @fsList to have the function return a list or @fsArray to return an array.

 

names-only 

Use this optional parameter to control the contents of the returned directory listing. As the name implies setting the parameter to @True(1) causes the function to return only the names of files and directories. Set the parameter  to  @False(0) causes the function to include additional information with each file or directory contained within the target directory. The additional information is usually space delimited and may consist some combination of the file size, date created or modified, and permissions. The information is usually space delimited but the additional information returned and the  delimiter is server dependent. If the parameter is not specified, @True is assumed.

Example:
  AddExtender('ilcfs44i.dll',0,'ilcfs64i.dll')
  host = 'test.example.com'
  port = 21
  user = 'demo'
  pswd  = 'password'
  
  ; Create a client
  client = fsClientInit(host, port, user, pswd)
  
  ; Get a listing for the morestuff directory
  dir = "test/dummy/stuff/morestuff"
  list = fsDirList(client, dir, @fsList)
  
  file = AskItemlist('Select a File', list, @lf, @sorted, @single)
  Message('You Selected',file)
  
  ; Disconnect and remove
  fsClientDelete(client)
See Also:

fsDirCreate, fsDirDelete