|
SmartFTP FTP Library
|
This interface is implemented by the FTPItems class.
IFTPItems
interface IFTPItems : IDispatch;VBScript
Dim objFTP
Set objFTP = CreateObject("sfFTPLib.FTPConnectionSTA")
...
objFTP.ReadDirectory()
Dim objItems
Set objItems = objFTP.Items
Dim FTPFile
For Each FTPFile In objItems
WScript.Echo("Type=" & FTPFile.Type & ", Name=" & FTPFile.Name & ", Size=" & FTPFile.SizeLo & ", Date=" & CDate(FTPFile.Date))
Next
JavaScript
var objFTP = new ActiveXObject("sfFTPLib.FTPConnectionSTA"); objFTP.ReadDirectory(); var objItems = objFTP.Items; for (var fc = new Enumerator(objItems); !fc.atEnd(); fc.moveNext()) { var FTPFile = fc.item(); WScript.Echo("Type=" + FTPFile.Type + ", Name=" + FTPFile.Name + ", Size=" + FTPFile.Size32 + ", Date=" + FTPFile.Date); }
C#
if(ftp.ReadDirectory() == sfFTPLib.enumError.ftpErrorSuccess) { CFTPItems ftpItems = ftp.Items; // Use the foreach statement to iterate through elements in the collection foreach(CFTPItem objItem in ftpItems) { System.Console.WriteLine("Type={0}; Name={1}; Size={2}", objItem.Type, objItem.Name, objItem.Size); } }
C++
#import "libid:7A3A786C-EB8C-43b3-BC10-8D09ACF5D195" version("1.5") // Note: Uncomment for Microsoft Visual Studio 6.0 //#import "C:\Program Files\SmartFTP FTP Library\sfFTPLib.dll" IFTPItemsPtr pDirectory = m_FTP->Items; if(pDirectory) { int nCount = pDirectory->Count; if(nCount > 0) { IEnumVARIANTPtr pEnum = pDirectory->_NewEnum; VARIANT *pArrVariant = new VARIANT[nCount]; if(pArrVariant) { ULONG CeltFetched; if(SUCCEEDED(pEnum->Next(nCount, pArrVariant, &CeltFetched))) { for(ULONG i=0; i<CeltFetched; i++) { if(pArrVariant[i].vt == VT_DISPATCH) { IFTPItemPtr pFTPItem = pArrVariant[i].pdispVal; if(pFTPItem) { CString str; str.Format(_T("Type=0x%x, Name=%s; Size=%d"), pFTPItem->Type, (LPCTSTR)pFTPItem->Name, pFTPItem->Size); } } ::VariantClear(pArrVariant[i]); } } delete [] pArrVariant; } } }
|
IFTPItems Methods |
Description |
|
Adds object to the collection. | |
|
Searches the collection for an item by name. (case sensitive) | |
|
Searches the collection for an item by name. (case insensitive) | |
|
Returns the item at the specified index. | |
|
Loads items from xml file. | |
|
Saves items to xml file. |
|
IFTPItems Properties |
Description |
|
Creates an enumerator object for the collection. | |
|
Contains the number of items in the collection. | |
|
This is NewEnum, a member of class IFTPItems. | |
|
This is NewReverseEnum, a member of class IFTPItems. |
|
What do you think about this topic? Send feedback!
|
|
Copyright (c) by SmartSoft Ltd. All rights reserved.
|