Using ArcGIS Pro I built a model to create a file geodatabase and import shapefiles to it. When run in Model Builder, it completes successfully. Then I exported the model to a Python script and ran it from a command prompt. It went through the motions but instead of importing the shapefiles, it merely copied the shapefiles to the folder where the newly-created fgdb is located, leaving the fgdb empty. #Anyone have an idea what went wrong?
Here is the Python script generated by ArcGIS Pro. I have changed the actual folder and file names.
# -*- coding: utf-8 -*-
"""Generated by ArcGIS ModelBuilder on: 2019-09-02 11:10:24
All ModelBuilder functionality may not be exported. Edits may be required for equivalency with the original model.
"""
import arcpy
# To allow overwriting the outputs change the overwrite option to true.
arcpy.env.overwriteOutput = False
# Local variables:
AAA_shp = r"C:\xyz\database\ShapeFiles\AAA.shp"
BBB_shp = r"C:\xyz\database\ShapeFiles\BBB.shp"
CCC_shp = r"C:\xyz\database\ShapeFiles\CCC.shp"
DDD_shp = r"C:\xyz\database\ShapeFiles\DDD.shp"
database = r"C:\xyz\database"
YYYY_gdb = database
YYYY_gdb__2_ = YYYY_gdb
# Process: Create File Geodatabase
arcpy.CreateFileGDB_management(out_folder_path=database, out_name="YYYY", out_version="CURRENT")
# Process: Feature Class To Geodatabase
arcpy.FeatureClassToGeodatabase_conversion(Input_Features=r"C:\xyz\database\ShapeFiles\AAA.shp;C:\xyz\database\ShapeFiles\BBB.shp;C:\xyz\database\ShapeFiles\CCC.shp;C:\xyz\database\ShapeFiles\DDD.shp", Output_Geodatabase=YYYY_gdb)