Delete Files Stored in ArcCatalog

473
2
09-26-2017 01:26 PM
JonathanUrshan
New Contributor

So I am writing a script that exports a feature class then zips it up and emails it to whoever needs it.  I am having trouble because I need to be able to delete the exported shapefiles so that I can use this tool and not have old exported data in the zip file.  I can not use CopyFeature_Management because some of the data is not a shapefile (Image of that is below). So I have to use FeatureClasstoShapefile_conversion instead which doesn't let me overwrite the previously exported shapefiles.  So I just end up getting shapefiles with a _1 after them. I am either doing this wrong or I need to find some way of deleting files in ArcCatalog without doing so manually.  I have os.remove() to delete the zip file, but its just that darn

0 Kudos
2 Replies
AdrianWelsh
MVP Honored Contributor

Jonathan,

It might be a good idea to share your script and tag https://community.esri.com/community/developers/gis-developers/python?sr=search&searchId=6d92d6f6-49...‌ (assuming you're using Python).

JayantaPoddar
MVP Esteemed Contributor

If you are working with Python, try adding the following line after importing the modules.

arcpy.env.overwriteOutput = True


Think Location