TIpClientFtp() > File methods xHarbour Developers Network  

oTIpClientFtp:listFiles()

Retrieves file information from the FTP server as array.

Syntax

:listFiles( [<cFileSpec>] ) --> aFiles

Arguments

This is a character string holding the drive file specification to retrieve information for. It defaults to an empty string ("") which retrieves all available file information from the FTP server.

Description

Method :listFiles() sends the LIST command along with an optional file specification to the FTP server and returns the file information as a two-dimensional array. The following #define constants from the Directry.ch file can be used to access individual columns of the file information array:

Constants for the file information array
ConstantPositionDescriptionData type
F_NAME1File nameCharacter
F_SIZE2File size in bytesNumeric
F_DATE3Creation dateDate
F_TIME4Creation timeCharacter
F_ATTR5File permissions (attributes)Character
F_LEN+16Number of links to fileNumeric
F_LEN+27Owner nameCharacter
F_LEN+38Group nameCharacter

The column F_ATTR contains a character string of 10 bytes. It encodes the file type in its first byte and file permissions for the owner, group and public in the following nine bytes.

File types (1st byte of F_ATTR)
CharacterDescription
-Regular file
bBlock special file
cCharacter special file
dDirectory
lSymbolic link
nNetwork file
pFIFO
sSocket

The next nine characters are in three groups of three bytes. They describe the permissions on the file. The first group of three describes owner permissions, the second describes group permissions, and the third describes other (or public) permissions. Because Windows systems do not support group and other permissions, these are copies of the owner's permissions. Characters that may appear are:

File permissions (byte 2-10 of F_ATTR)
CharacterDescription
rPermission to read file
wPermission to write to file
xPermission to execute file
tTemporary file


Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe