<< Click to Display Table of Contents >> Navigation: 3. Script Language > Filesystem-Commands > Filesystem-Commands |
MiniRobotLanguage (MRL)
IEF. Conditional Statement
If Exist File / Folder
Intention
Conditional Statement. Test if a specified file or directory exists or not.
You can specify additional Parameters to test if something is a file or a dir.
When you specify a directory path, the robot will check if the last sign of the name/path is a \ (backslash).
If the last sign is a backlash, then the command will check for a directory (NOT for a file!).
If the last sign is NOT a backslash, the command will check for a file NOT for a directory.
' We can use wildcards.
' The real name of the file or dir is on the TOS
'
IEF.?desktop\t*.*
PRT.Is a file and exists: $tos$
ELS.
PRT. does not exist or is not a file.
EIF.
You can use NEF.(Not Exists File) as the negative Form of the command.
Syntax
IEF.P1[|P2] … ELS. … EIF.
Parameter Explanation
P1 - Variable/filename/directory-path ending with a \ (backslash)
can contain wildcards like ? and *
P2 - Options: these can only be an e - e like "exclusive"
e - "exclusive" will only go on true if its a file and the file
is not locked (can be accessed).
Speed in Ticks:
This command uses typically around 1900 Ticks depending on general files-system Speed.
Example
'**********************************************
' IEF-Sample
'**********************************************
' DBM.2
: §§FIL=?desktop\2Line.txt
IEF.§§FIL
PRT.File exists: §§FIL
ELS.
PRT.File doesn't exist: §§FIL
EIF.
' Works with Dirs too ...
IEF.?ws\
PRT.DIr exists: ?ws\
ELS.
PRT.Dir doesn't exist: ?ws\
EIF.
' We can use wildcards.
' The real name of the fiel or dir is on the TOS
'
IEF.?desktop\t*.*
PRT.Is a file and exists: $tos$
ELS.
PRT. doesn't exist or is not a file.
EIF.
END.
Remarks
IEF. and other IXX. can be nested to unlimited Depth, and they can also enclose Sub-Program Calls or FEX. (Enumerations) to unlimited Depth.
Limitations:
-
See also:
IEF. / NEF. - If - exist - File