FileOps.$getfileinfo()

Function group Execute on client Platform(s)
FileOps NO All

Syntax

FileOps.$getfileinfo(cPath,iInformation)

Description

Returns a list of file information for the file named cPath. Pathnames can be over 255 characters, which was the limit in Studio 8.0.1 or earlier.

You specify the information to be returned by passing iInfoFlags as a combination of the kFileOpsInfo... constants listed in the following table. If you omit iInfoFlags, only the name is returned. The returned list contains a column for each kFileOpsInfo... constant you specify. The columns you specify occur in the same order as the table.

Col name info flags constant description
name kFileOpsInfoName name of the file
name83 kFileOpsInfoName83 DOS 8.3 name of the file
fullname kFileOpsInfoFullName full pathname of the file
readonly kFileOpsInfoReadOnly file's read-only status
hidden kFileOpsInfoHidden file's hidden status
size kFileOpsInfoSize logical size of file
actualsize kFileOpsInfoActualSize physical size of file on disk; same as logical size under Windows and Unix
created kFileOpsInfoCreated date and time the file was created
modified kFileOpsInfoModified date and time the file was modified
creator kFileOpsInfoCreatorCode the file's creator under macOS, blank under Windows and Unix
type kFileOpsInfoTypeCode the file's type under macOS, the file extension under Windows and Unix
linkedname kFileOpsInfoLinkedName macOS: the path of the linked file (if any)
Windows: the path of the shortcut target (if any)
Unix: the path of the symbolic link target (if any)
isdirectory kFileOpsInfoIsDirectory if the path specified points to a directory
calcdirectorysize kFileOpsInfoCalcDirectorySize the size in bytes of the directory on the file system

The function returns an empty list if an error occurs: see the FileOps function error codes.

The FileOps object supports 64-bit integers for file sizes and for offsets, etc in files.

Example

Do  sys(10) Returns lPath
# returns the name and path of the current library

Do FileOps.$getfileinfo(lPath,kFileOpsInfoName+kFileOpsInfoSize+kFileOpsInfoCreatedReturns lFileList
# returns the name, size, creation date and time of the current library

Do lFileList.$redefine(lFilename,lSize,lCreated)
Do lst(lFileList,1,lSizeReturns lSize
# returns the value in the size column