stat

The stat() function returns general information, from the operating system, about the requested file or directory on the policy server host. result contains an empty list (that is, with length equal to 0) if the specified file or directory is not found. The length() function can be used to determine whether result is empty.

result = stat (path);

path Required. Character string containing a path and/or file name.

result is a list that contains file and/or directory information. Each element in the list contains a different piece of information, as shown below. Each list element is a character string. An empty list is returned (that is, with list length equal to 0) if the specified file or directory does not exist. If result is empty, then the specified path or file was not found.

result elements:

  • result [0] = file size
  • result [1] = file owner
  • result [2] = file group
  • result [3] = file permissions
  • result [4] = file access time
  • result [5] = file creation time
  • result [6] = file modification time
  • result [7] = file access date
  • result [8] = file creation date
  • result [9] = file modification date
  • result [10] = file access time in seconds
  • result [11] = file creation time in seconds
  • result [12] = file modification time in seconds
  • result [13] = inode number
  • result [14] = device number
result = stat ("/etc");

In the example, result might contain the following elements:

result [0] = 7144
result [1] = bin
result [2] = bin
result [3] = 755
result [4] = 101
result [5] = 101
result [6] = 101
result [7] = 1970/01/01
result [8] = 1970/01/01
result [9] = 1970/01/01
result [10] = 1
result [11] = 1
result [12] = 1
result [13] = 20
result [14] = 2

For more information, please see the following: