Name
GetFileAttributes -- get attributes of a file or directory (V3.0)
Synopsis
t = GetFileAttributes(f$[, adapter$])
Function
This function returns a table that contains the attributes of a file or directory. This includes information such as the file time, the full path of the file, protection flags, and more, depending on the host file system. Pass the name of a file or a directory to this command. You can specify an empty string ("") to get information of the current directory.

Starting with Hollywood 6.0 GetFileAttributes() accepts an optional adapter$ argument which allows you to specify one or more file adapters that should be asked to open the specified file. See Loaders and adapters for details.

On return, the table will have the following fields initialized:

Type:
This will be #DOSTYPE_FILE if f$ is a file or #DOSTYPE_DIRECTORY if f$ is a directory.

Path:
This field will contain a string with the full path to this file or directory.

Size:
This field will only be present if f$ is a file. In that case, this field will receive the size of the file in bytes.

Flags:
This field will receive a combination of protection flags of the file or directory. See Protection flags for details.

Time:
This field will receive a string containing the time the file or directory was last modified. The string will always be in the format dd-mmm-yyyy hh:mm:ss. E.g.: 08-Nov-2004 14:32:13.

LastAccessTime:
This field will receive a string containing the time the file or directory was last accessed. This attribute is not supported on AmigaOS.

CreationTime:
This field will receive a string containing the time the file or directory was created. This attribute is only supported on Win32.

Comment:
This field will contain the comment of a file. This is only supported by the Amiga versions.

Virtual:
This field will be set to True if the file you passed to this function is a virtual file, i.e. a file linked to your applet/executable or a file created using DefineVirtualFile(). (V5.2)

If you want to query the attributes of a file that you have opened using OpenFile(), use FileAttributes() instead. See FileAttributes for details.

Inputs
f$
name of file or directory to be examined
adapter$
one or more adapter(s) that should be asked to open the file (defaults to default) (V6.0)
Results
t
a table initialized as shown above
Example
t = GetFileAttributes("test.txt")
Print(t.time)
If t.flags & #FILEATTR_READ_USR
  Print("#FILEATTR_READ_USR is set.")
Else
  Print("#FILEATTR_READ_USR is not set.")
EndIf
The code above examines the file "test.txt" and prints the time it was last modified to the screen. Additionally, it checks if the protection flag #FILEATTR_READ_USR is set.

Show TOC