Path Exists
Checks if the file/directory in the specified path exists or not
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
if ContinueOnError property is true, no error is caught when the project is executed even if Catch node is used.
Input
- Path - The path of the file/directory that will be checked whether exist or not.
Output
- Result - If the file/folder in a given path exists, it returns true, otherwise returns false
How It Works
The Path Exists node checks file or directory existence through the following process:
- Validates that the path is not empty
- Uses os.Stat to check if the path exists in the filesystem
- Returns true if the path exists (file or directory)
- Returns false if the path does not exist
- Sets the result in the output variable
Requirements
- Valid path string to check
- Read permissions on the parent directory
- Path can be either a file or directory
Error Handling
| Error Code | Description |
|---|---|
Core.FileSystem.PathExists.ErrOnCreate | Node configuration parsing failed |
Core.FileSystem.PathExists.ErrOnMessage | Input message parsing failed |
Core.FileSystem.PathExists.ErrPath | Path is empty |
Usage Examples
Example 1: Check if Configuration File Exists
Verify if a configuration file exists before reading it:
{
"path": "C:\\Config\\app_settings.json"
}
Output:
{
"result": true // or false if file doesn't exist
}
Use with an If node to branch based on the result.
Example 2: Verify Directory Before Processing
Check if an archive directory exists before moving files:
{
"path": "D:\\Archive\\2024"
}
If result is false, create the directory before moving files.
Example 3: Conditional File Processing
Check if a specific file exists to avoid errors:
{
"path": "C:\\Reports\\{{ $filename }}.xlsx"
}
Use the result to decide whether to process or skip the file.
Usage Notes
- The node checks both files and directories - it doesn't distinguish between them
- Returns false for paths with insufficient permissions (treated as non-existent)
- Network paths (UNC paths) are supported
- Symbolic links are followed - checks if the target exists
- The node never throws errors for non-existent paths, only returns false
- Path validation happens before existence check
Tips
- Use before Read File, Delete, Move, or Copy operations to prevent errors
- Combine with If node to implement conditional logic based on file existence
- Use with Create File/Dir to check before creating to avoid overwrite errors
- Helpful for implementing file-watching patterns in automation
- Consider using Wait File instead if you need to wait for a file to appear
- Use in loops to verify multiple files before batch processing
- Good practice to check paths received from external sources or user input
Related Nodes
- Wait File - Wait for a file to exist or be deleted
- Create File/Dir - Create file/directory if it doesn't exist
- Read File - Read file after verifying existence
- List Directory - List files in directory after verifying it exists