I'm trying to create a folder and export the following shape files to the new folder. I got it to create the folder but I can't seem to get the shapefiles to the new folder.

import arcpy
import datetime
from arcpy import env

env.workspace = "C:/UPDM.gdb"
out_folder_path = "C:/output"
nowstart = datetime.datetime.now()
YearMonthDay = nowstart.strftime("%Y_%m_%d")
out_name = "WebTMS_BU_" + YearMonthDay + ""

arcpy.CreateFolder_management(out_folder_path, out_name)


2 Answers 2


You need to reference the full output folder path in your FeatureClassToShapefile_conversion call. Currently you are passing your out_name variable which only represents the string "WebTMS_BU_" + YearMonthDay + "". So make this change:


And you will need to add the os module:

import os

To add to the answer above, another way is to use Arcpy.getOutput method. In this way, you can set the output of the geoprocessing tool as a variable. For example:

result = arcpy.CreateFolder_management(out_folder_path, out_name)
new_folder = result.getOutput(0)

The variable "new_folder" can then be used going forward through your script when using ArcGIS geoprocessing.


However, this method wont work when using other python modules outside of Arc. The OS method mentioned above is a more full-proof python way of joining paths, but just wanted to mention the get.Output method which can be used to identify the outputs from most Arc geoprocessing functions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.