<< back to sysax.com Product page

5.2. Enumerating Listing Items

The list of retrieved files and folders can be enumerated to access the individual FTPListItem object. Each FTPListItem object contains the Name, IsFolder, Size, and ModTime methods to retrieve its name, file or folder status, size and last modification time.

Exhibit 5.3. IDL Definition of method for enumerating listing items


HRESULT Name     ([out, retval] BSTR *b_name);
HRESULT IsFolder ([out, retval] VARIANT_BOOL *f_is_folder);
HRESULT Size     ([out, retval] BSTR *b_size);
HRESULT ModTime  ([out, retval] BSTR *b_modtime);


Exhibit 5.4. Example usage of method for enumerating listing items (VBScript)


WScript.Echo "number of items in listing:", ftplist.Count

Dim ftpitem
For Each ftpitem In ftplist
  If ftpitem.IsFolder Then
    WScript.Echo "[folder]", ftpitem.Name, "(Size:", ftpitem.Size, "and Modification Timestamp:", ftpitem.ModTime, ")"
  Else
    WScript.Echo "[file]  ", ftpitem.Name, "(Size:", ftpitem.Size, "and Modification Timestamp:", ftpitem.ModTime, ")"
  End If
Next