CreateDirectory
FileTools
Description
Create directories and complete folder structures with a single command! CreateDirectory supports recursive creation of nested paths and handles already existing folders intelligently.
With optional path validation and clear feedback about created or existing directories, you have full control over your file system structure. Perfect for project setup, backup structures, and automated folder creation.
Why This Tool Stands Out
- Nested Creation automatic
- Path Validation built-in
- Existence Handling graceful
- Structure Setup in seconds
Perfect for:
Developers who initialize project structures; system administrators who create backup paths; build systems that need output directories; and anyone who wants to automate folder hierarchies. Ideal for setup scripts and deployment routines.
Workflow support; time savings depend on the task
Instead of manually creating several nested folders, create complete directory trees with a single API call - including all parent paths that do not exist yet.
JSON Parameters
- directoryPath REQUIRED (String)The full path of the directory to create. Example: "C:\\Projects\\MyApp\\Logs\\2024"
- recursive OPTIONAL (Boolean)If true, all non-existent parent directories are created as well. Default: true
Example Call
{
"tool": "CreateDirectory",
"params": {
"directoryPath": "C:\\Backup\\2024\\January\\Week1",
"recursive": true
}
}
Return Values
The tool returns an object with the following properties:
- success (Boolean)
True if the creation was successful - directoryPath (String)
The full path of the created directory - created (Boolean)
True if a new directory was created, false if it already existed - directoriesCreated (Integer)
Number of directories actually created (with recursive creation) - error (String, optional)
Error message if the creation failed
Example Usage
Step-by-step guide:
- Define the desired directory path (e.g., "C:\\Projects\\2024\\January\\Week1")
- Set recursive to true to create parent directories automatically
- Call the CreateDirectory tool with the parameters
- The tool creates all necessary directories in the hierarchy
- Check the return values for the number of directories created
Related Tools
Ready to Automate Your Directory Structure?
Use CreateDirectory for efficient project setup and backup structures. Integrate it into your workflows now!
Discover All FileTools