Overview
This node checks whether a specified file or directory path exists on the filesystem. It can verify if the path points to any type (file or directory), specifically a file, or specifically a directory. Additionally, it can check access permissions (readable, writable, executable) and optionally resolve symbolic links to their target paths. The node is useful in workflows where conditional logic depends on the presence or attributes of files or directories, such as validating input files before processing, monitoring directory structures, or gating subsequent steps based on file availability.
Practical examples:
- Before uploading a file, confirm that the file exists and is readable.
- Check if a directory exists before attempting to write logs into it.
- Verify that a script file is executable before running it.
- Resolve symbolic links to ensure the actual target file is accessible.
Properties
| Name | Meaning |
|---|---|
| Path | The filesystem path to check for existence. Can be a file or directory path. |
| Check Type | What type of path to check for: - Any (File or Directory) - File Only - Directory Only |
| Include Details | Whether to include detailed information about the path if it exists, such as size, timestamps, permissions, ownership, and type. |
| Check Access | Specific access permissions to verify on the path: - Readable - Writable - Executable |
| Resolve Symbolic Links | Whether to resolve symbolic links to their real target paths. |
| Return Only If Exists | Only return output data if the path exists; skip non-existent paths. |
| Include Input Data | Whether to include the original input data from the workflow item in the output JSON. |
Output
The node outputs an array of items, each containing a json object with the following structure:
path: The resolved absolute path checked.name: The basename of the path.directory: The directory part of the path.exists: Boolean indicating if the path exists and matches the requested type.pathExists: Boolean indicating if the path exists regardless of type.typeMatches: Boolean indicating if the existing path matches the requested type (file/directory/any).checkType: The type of check performed ("any", "file", or "directory").details(optional): Detailed info if requested, including:type: "file", "directory", or "other"size: Size in bytescreated,modified,accessed: TimestampsisFile,isDirectory,isSymbolicLink: Booleans describing the path typepermissions: Object with numeric mode and octal string representationowner: Object with user ID (uid) and group ID (gid)realPath: Resolved real path if symbolic link resolution was enabled
access(optional): Object indicating access permission results, e.g.,{ readable: true, writable: false, executable: true }inputData(optional): Original input data from the workflow item if included.
If the path does not exist and Return Only If Exists is enabled, no output item is produced for that input.
If an error occurs and the node is configured to continue on failure, the output will contain an error message and indicate the path does not exist.
Dependencies
- Node.js built-in modules:
fs(filesystem operations)path(path resolution and parsing)
- No external API or service dependencies.
- Requires appropriate filesystem permissions for the user running n8n to access the specified paths and check permissions.
Troubleshooting
- Common issues:
- Providing an invalid or empty path will cause an error.
- Insufficient permissions to access the path may result in access check failures or inability to retrieve details.
- Symbolic link resolution may fail if the link is broken or inaccessible.
- Error messages:
"File path is required": Occurs if the path parameter is empty or missing.- Errors related to permission denied when checking access or reading stats.
- Resolutions:
- Ensure the path parameter is correctly set and accessible by the n8n process.
- Adjust filesystem permissions or run n8n with sufficient privileges.
- Disable symbolic link resolution if links are problematic.