Create Folder (Data Management)

Summary

Creates a folder in the specified location.

Usage

  • The output folder name must be unique.

Parameters

LabelExplanationData Type
Folder Location

The disk location where the folder is created.

Folder
Folder Name

The folder to be created.

String

Derived Output

LabelExplanationData Type
Output Folder

The new output folder

Folder

arcpy.management.CreateFolder(out_folder_path, out_name)
NameExplanationData Type
out_folder_path

The disk location where the folder is created.

Folder
out_name

The folder to be created.

String

Derived Output

NameExplanationData Type
out_folder

The new output folder

Folder

Code sample

CreateFolder example 1 (Python window)

The following Python window script demonstrates how to use the CreateFolder function in immediate mode.


import arcpy
arcpy.CreateFolder_management("C:/output", "folder1")
CreateFolder example 2 (stand-alone script)

The following Python script demonstrates how to use the CreateFolder function in a stand-alone script.

# Name: CreateFolder_Example2.py
# Description: Create a folder

# Import system modules
import arcpy

# Set local variables
out_folder_path = "C:/output" 
out_name = "folder1"

# Execute CreateFolder
arcpy.CreateFolder_management(out_folder_path, out_name)