Python script that checks to see if a specific layer file exists in the current workspace and, if it does, converts the layer file to a KML file. Does it work with a shapefile?
Code so far:
for file in arcpy.ListFiles("cities.shp"):
desc = arcpy.Describe(file)
#print "Name: " + desc.BaseName
name = desc.baseName
if name == "cities.shp":
arcpy.LayerToKML_conversion("cities.shp", "cities.kmz")
print "Converted"
else:
print ("There are no layers in ",env.workspace,".")