Class: | FTP_SERVICE |
Type | Array |
By reference | |
Direction | Output |
Type | Position | Name | Description |
C | [x, 1] | File name | Long file name if available |
C | [x, 2] | Alternate File name | Short file name if available |
N | [x, 3] | File Size | Size of file in bytes |
T | [x, 4] | File Create Date | File create date and time |
T | [x, 5] | File Last Access Time | Last access date and time |
T | [x, 6] | File Last Write Time | Last write date and time |
C | [x, 7] | File Attributes | File attributes |
Value | Description |
'R' | FILE_ATTRIBUTE_READONLY |
'H' | FILE_ATTRIBUTE_HIDDEN |
'S' | FILE_ATTRIBUTE_SYSTEM |
'D' | FILE_ATTRIBUTE_DIRECTORY |
'A' | FILE_ATTRIBUTE_ARCHIVE |
'N' | FILE_ATTRIBUTE_NORMAL |
'T' | FILE_ATTRIBUTE_TEMPORARY |
'C' | FILE_ATTRIBUTE_COMPRESSED |
'O' | FILE_ATTRIBUTE_OFFLINE |
Type | Character |
Direction | Input |
LOCAL loFTP,lii LOCAL ARRAY laFolders(1) #INCLUDE "ftp.h" SET PROCEDURE TO ftp.prg ADDITIVE loFTP=CREATEOBJECT('ftp_service') IF loFTP.OpenInternet("ABONNE", "PWD", "10.10.10.10", "21") IF !loFTP.GetFTPDirectoryArray(@laFoders,"*.txt") ?loFTP.GetExtendedErrorCode(),loFTP.GetExtendedErrorMsg() ELSE FOR lii=1 TO ALEN(laFolders,1) ?laFolders[lii, 1 && File name ?CHR(9)+"Alternate File name: "+laFolders[lii, 2] ?CHR(9)+"File Size: "+laFolders[lii, 3] ?CHR(9)+"File Create Date: "+laFolders[lii, 4] ?CHR(9)+"File Last Access Time: "+laFolders[lii, 5] ?CHR(9)+"File Last Write Time: "+laFolders[lii, 6] ?CHR(9)+"File Attributes: "+laFolders[lii, 7] NEXT ENDIF =loFTP.CloseInternet() ENDIF RELEASE PROCEDURE ftp.prg
LPARAMETERS OUTREF laDirectory, INP lcMask LOCAL cStruct, liResult, lnCount, fResult, lffHandle IF This.OpenFTPConnection(This.cStartupFolder) && Open an FTP Handle lcMask = lcMask + cNULL * Dimension the array to store the directory * [x, 1] = FileName * [x, 2] = Alternate FileName * [x, 3] = File Size * [x, 4] = File Create Date * [x, 5] = File Last Access Time * [x, 6] = File Last Write Time * [x, 7] = File Attributes DIMENSION laDirectory [1, 7] laDirectory [1, 1] = .F. * This is for a FoxPro Quirk. lcStruct = SPACE(319) && Allocate space for the returned structure =This.BeforeGetFTPDirectoryArray(@laDirectory, @lcMask) * Get the first file or find out if lffHandle = FtpFindFirstFile(This.nConnect_Handle, @lcMask, @lcStruct, 0, 0) This.GetExtendedError() IF lffHandle = 0 OR This.nResult_Code = ERROR_NO_MORE_FILES This.CloseFTPConnection() && Close FTP Handle RETURN .F. ENDIF * Parse out First File Information =This.CrackFile(lcStruct, @laDirectory) llResult = 1 DO WHILE This.nResult_Code != ERROR_NO_MORE_FILES AND llResult != 0 lcStruct = SPACE(319) * Get next files liResult = InternetFindNextFile(lffHandle, @lcStruct) =This.GetExtendedError() * If we got good information, go ahead and parse it IF This.nResult_Code != ERROR_NO_MORE_FILES AND llResult != 0 =This.CrackFile(lcStruct, @laDirectory) ENDIF ENDDO =This.AfterGetFTPDirectoryArray(@laDirectory, @lcMask,liResult) =This.CloseFTPConnection() && Close FTP Handle ELSE RETURN .F. && Unable to get FTP Connection ENDIF RETURN .T.