(FSTATUS('filespec'))
Checks to see if a file or folder name exists, and also returns the status for a file. If no path is specified, the function checks for the file or folder name in the current directory. Otherwise, the function checks for the file or folder name in the specified location.
Return Value |
Status |
0 |
file/folder does not exist |
1 |
file/folder exists, but cannot be read or written to. Folders will return this value, as well as file name searches with wild cards. |
2 |
file is marked as a read only |
3 |
file is not marked as read only, but can only read it at this time (the file is opened by another program) |
4 |
file can be read and written to |
+10 |
If the file is marked as hidden, the return value will be incremented by 10; 12 = read only and hidden 14 = can read and write and hidden |
Examples:
Example 01 (The brates.xlsx file exists, is marked hidden, and is opened):
SET VAR vFileStatus INTEGER = (FSTATUS('brates.xlsx'))
SHOW VAR vFileStatus
13
Example 02 (The CheckVersion.rmd file exists and is marked as read only):
SET VAR vFileStatus INTEGER = (FSTATUS('CheckVersion.rmd'))
SHOW VAR vFileStatus
2