SmartFTP FTP Library
|
This interface is implemented by the FTPItems class.
IFTPItems
interface IFTPItems : IDispatch;
VBScript
Dim objFTP Set objFTP = CreateObject("sfFTPLib.FTPConnectionSTA") ... Dim objItems Set objItems = objFTP.ReadDirectory() 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"); var objItems = objFTP.ReadDirectory(); 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#
CFTPItems ftpItems = ftp.ReadDirectory(); // 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" // Note: Uncomment for Microsoft Visual Studio 6.0 //#import "C:\Program Files\SmartFTP FTP Library\sfFTPLib.dll" IFTPItemsPtr pDirectory = m_FTP->ReadDirectory(); if(pDirectory) { int nCount = pDirectory->Count; if(nCount > 0) { IEnumVARIANTPtr pEnum = pDirectory->_NewEnum; VARIANT *pArrVariant = new VARIANT[nCount]; 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=%I64u"), pFTPItem->Type, (LPCTSTR)pFTPItem->Name, pFTPItem->Size); } } ::VariantClear(pArrVariant[i]); } } delete [] pArrVariant; } }
SFTP
VBScript
Dim objItems Set objItems = objSFTP.ReadDirectory(".") Dim objItem For Each objItem In objItems WScript.Echo("Type=" & objItem.Type & ", Name=" & objItem.Name & ", Size=" & objItem.SizeLo & ", Date=" & CDate(objItem.ModifyTimeAsDate)) Next
JavaScript
var objItems = objSFTP.ReadDirectory("."); for (var fc = new Enumerator(objItems); !fc.atEnd(); fc.moveNext()) { var objItem = fc.item(); WScript.Echo("Type=" + objItem.Type + ", Name=" + objItem.Name + ", Size=" + objItem.SizeLo + ", Date=" + objItem.Date); }
C#
CFTPItems items = sftp.ReadDirectory("."); // Use the foreach statement to iterate through elements in the collection foreach(CFTPItem objItem in items) { System.Console.WriteLine("Type={0}; Name={1}; Size={2}", objItem.Type, objItem.Name, objItem.Size); }
Example
IFTPItems Methods |
Description |
This is Append, a member of class IFTPItems. | |
This is AppendFromArray, a member of class IFTPItems. | |
This is GetAt, a member of class IFTPItems. | |
This is GetView, a member of class IFTPItems. | |
Returns the item at the specified index. |
What do you think about this topic? Send feedback!
|
Copyright (c) by SmartSoft Ltd. All rights reserved.
|