Retrieving a Folder Listing (GetList)

Use the GetList method to download folder listings.

Syntax

Object.GetList(BSTR bstrPath, BSTR bstrLocalFile, BSTR bstrFormat, BOOL *pVal)

Parameters

bstrPath

The remote path to be listed. Leave it empty if its the current path.

bstrLocalFile

Specifies a local file name where the listing can be saved.

bstrFormat

Can be used to format the listing. If left empty, a raw listing will be returned. You can specify %NAME, %DATE, and %SIZE as return values in a string.

Example

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.Host = "ftp.cuteftp.com/pub"

MySite.Connect

MySite.GetList "", "c:\temp_list.txt" 'saves a raw listing for the default path to the file temp_list.txt

MsgBox MySite.GetResult 'retrieves and displays the listing

Example 2

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.Host = "ftp.cuteftp.com"

MySite.Connect

MySite.GetList "/pub", "", "FILE NAME:   %NAME" 'goes to pub folder, doesn't save the listing to file, and formats it as shown

MsgBox MySite.GetResult 'retrieves and displays the listing

Example 3

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.Host = "ftp.cuteftp.com"

MySite.Connect

MySite.GetList "/pub", "", "NAME= %NAME SIZE= %SIZE DATE= %DATE" 'goes to pub folder, doesn't save the listing to file, and formats it as shown

MsgBox MySite.GetResult 'retrieves and displays the listing

 

GetResult is an optional method used only with GetList. It simply retrieves the data. Without GetResult the data is written to the buffer, or if defined in the parameters, the data is written to the log.