fileinfo(
PATH
)

The fileinfo( function returns information about a file (or folder) on the disk, including the size, creation and modification date and time, type, creator and lock status.


Parameters

This function has one parameter:

path – is a path to the item you want information about, including the file (or folder) name (see Files and Folders for more information about file paths).


Description

This function returns a text array with 8 elements separated by carriage returns. (However, if the specified item does not exist, the function returns empty text ("") ). (Note: You may prefer to use the newer fileattributes( function which returns more information about the file than fileinfo( does, and returns the information in a more convenient dictionary format.)

The eight elements are:

1) Type of File – This is either "File" or "Folder".

2) Type Code – This is the file’s type code, for example TEXT for text files or JPEG for JPEG image files. See typecreatorcode( for more information about these codes. (Note: New applications should not use this code, instead, use the file’s extension, for example .jpg or .txt .

3) Creation Date – This is the file’s creation date, expressed as a number. If you want to format the date using a more traditional format, use the datepattern( function like this:

datepattern(nthline(fileinfo("~/image.jpg"),3),"Month ddnth, yyyy")

4) Creation Time – This is the file’s creation time, expressed as the number of seconds since midnight. If you want to format the time using a more traditional format, use the timepattern( function like this:

timepattern(nthline(fileinfo("~/image.jpg"),4),"hh:mm:ss AM/PM")

5) Modification Date – This is the file’s modification date, expressed as a number. If you want to format the date using a more traditional format, use the datepattern( function like this:

datepattern(nthline(fileinfo("~/image.jpg"),5),"Month ddnth, yyyy")

6) Modification Time – This is the file’s modification time, expressed as the number of seconds since midnight. If you want to format the time using a more traditional format, use the timepattern( function like this:

timepattern(nthline(fileinfo("~/image.jpg"),6),"hh:mm:ss AM/PM")

7) Size – This is the file’s size in bytes. (See also the filesize( function.)

8) Locked – This is either "Locked" or "Unlocked", depending on whether or not the Locked option is checked in the Finder’s Get Info window for this file or folder.

Here is a typical result from this function

File
PDF     
2455862
65420
2455862
65420
71070
Unlocked

In this case, the file is an unlocked PDF file containing 71,070 bytes. The particular file was created and last modified on October 27, 2011 at 6:10 PM.

Legacy Syntax (Separate Folder and File Parameters)

In older versions of Panorama (6.0 and earlier) the fileinfo( function had two parameters, folderid and filename. To maintain compatibility with older databases, two parameters will still work, as shown in this example:

fileinfo(folder("~/Documentation"),"news.txt")

For new applications, you’ll probably find it easier to use the single parameter mode.


See Also


History

VersionStatusNotes
10.0UpdatedCarried over from Panorama 6.0, but now may have either one parameter (path) or two (folder, path).