C.50. STAT()

STAT(flag,filename)
(beginning Asterisk 1.4)
Returns status information about a file (compare the shell commands test and stat). The filename refers to an inode, so it can be a directory or a specific file. The flag can be one of the following:
d
Tests to see if filename is a directory.
e
Tests if the file exists.
f
Tests if filename is a regular file (as opposed to a special file, such as a block special file, character special file, symbolic link, named pipe, or socket).
m
Returns the mode of filename (octal), i.e. the permissions: e.g. 0754.
s
Returns the file size in bytes.
A
Returns the last access time (in Unix time).
C
Returns the last inode change time (in Unix time).
M
Returns the last modified time (in Unix time).
; See when /etc/crontab was last changed:
exten => 123,1,Set(foo=${STAT(M,/etc/crontab)})

Note

Internal help for this application in Asterisk 1.4:
  -= Info about function 'STAT' =- 

[Syntax]
STAT(<flag>,<filename>)

[Synopsis]
Does a check on the specified file

[Description]
flag may be one of the following:
  d - Checks if the file is a directory
  e - Checks if the file exists
  f - Checks if the file is a regular file
  m - Returns the file mode (in octal)
  s - Returns the size (in bytes) of the file
  A - Returns the epoch at which the file was last accessed
  C - Returns the epoch at which the inode was last changed
  M - Returns the epoch at which the file was last modified
diff output to internal help in Asterisk 1.2:
-- not available in Version 1.2 --