I am having an issue with using arcpy.CopyFeatures_management. I am attempting to copy shape files from a temp directory and write them to a database as feature classes. What is wrong with this code? My print function correctly lists all of the shape files in the temp directory however It then writes one shape to my database directory and gives it the database name.
import arcpy
from arcpy import env
import os
import sys
arcpy.env.overwriteOutput = True
workspace = "S:\\xxx\\GIS\\"
feature_classes = []
walk = arcpy.da.Walk(workspace, datatype="FeatureClass", type="FeatureClass")
outWorkspace = "S:\\xxx\\xxx\\xxx.gdb"
for dirpath, dirnames, filenames in walk:
for filename in filenames:
feature_classes.append(os.path.join(dirpath, filename))
print feature_classes
for filename in feature_classes:
outFeatureClass = os.path.join(outWorkspace, filename.strip(".shp"))
arcpy.CopyFeatures_management(filename, outWorkspace)