Check if there is a file in the specified path.
1 file.exists
<file.exists>
<file /> !
</file.exists>
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Efile | file |
Returns | |
---|---|
Type | Description |
Boolean | Returns true if the file exist in the specified path. |
Example
Verify the existence of a file.
Copy
<xsql-script name='file_exists_sample1'> <body> <set name='m_path'> <string>c:<file.separator />tmp<file.separator />source<file.separator />deister.txt</string> </set> <if> <expr> <file.exists> <file name='#m_path' type='absolute' /> </file.exists> </expr> <then> <set name='m_result'>existente</set> </then> <else> <set name='m_result'>no encontrado</set> </else> </if> <println>Fichero <m_path/> <m_result/></println> </body> </xsql-script>
Note that even when the function returns a Boolean value, the comparison of equality is ignored in the expression of the conditional statement and the condition is true if the label returns 1.