Description
Creates a directory at the specified path. Optionally creates parent directories if they don’t exist.Method Signature
Parameters
Absolute path where the directory should be created
Returns
Result of the mkdir operation
Whether the directory was created successfully
Path to the directory that was created
Whether the operation was performed recursively
ISO 8601 timestamp of when the operation completed
Exit code from the underlying mkdir command (0 = success)
Examples
Create a single directory
Create nested directories
Create directory in a specific session
Create directory before writing files
Error Handling
The method throws an error if:- The directory already exists (not an error with
recursive: true) - Parent directories don’t exist (without
recursive: true) - Insufficient permissions
- The path is invalid
Notes
- Default directory permissions are typically 755 (rwxr-xr-x)
- Using
recursive: trueis safe even if the directory already exists - The
/workspacedirectory is the default working directory in sandboxes
See Also
- writeFile - Write content to a file
- listFiles - List directory contents
- deleteFile - Delete files and directories