&stat - Retrieve a file statistic
&stat <stat> <filename>
&stat returns the specified <stat> on the given <filename>. Valid <stat> values are:-
a
d
r
s
t
0 File does not exist. 1 File is a regular file. 2 File is a directory. 3 File is a URL link (i.e. http://...). 4 File is a untouchable system file.
w
x
The following example is a macro which, given a file name, uses &stat to check that file file is regular:
define-macro test-file !force set-variable #l0 @1 !if ¬ $status set-variable #l0 @ml04 "File name" !endif !if ¬ &equ &stat "t" #l4 1 ml-write &spr "[%s is not a regular file]" #l0 !abort !endif !emacro test-file "foobar"
The macro can be passed a file name and aborts if the file is not regular, there by returning the state.
The follow example checks that a file is not empty, this is used by mail-check to test for any incoming mail.
!if &gre &stat "s" %incoming-mail-box ml-write "[You have new mail]" !endif
(c) Copyright JASSPA 1999
Last Modified: 1998/09/08
Generated On: 1999/12/01