Skip to main content

Check-Path-Is-File

Command Description

Specify a file path or a variable. If it is a file, it will return True, If it is not a file, it will return False. If it is illegal, it will throw an error and stop

Command Prototype

bIsFile = File.IsFile(sPath)

Parameter Description

ParameterRequiredTypeDefaultDescription
sPathTruepath'''C:\Users'''The path of the file, you can fill in the absolute path or use the @res "path" form to indicate the path under the res folder of the current process, the path separator must be escaped, such as "C:\Laiye RPA" or @res"Laiye RPA\Laiye RPA "

return

bIsFile,The variable used to save the output of the command.

Demo

/******************************** Determine whether the path is a file ************ ***************** 
Command prototype:
bIsFile = File.IsFile('''C:\Users''')
Input parameters:
sPath--path to file
Outgoing parameters:
bIsFile--the result after the command is run
********************************************************************************/
Dim sPath='''C:\Users\Chance\Desktop\testFile\data.txt'''
bIsFile = File.IsFile(sPath)
TracePrint(bIsFile)