Mr Bakker thanks a lot for your response. I tried to make a tool with your scipt because i want to run it inside modelbuilder but it fails. Here is the code. I changed the "samp" and "PNT500" cause i run the model again and i have different names now. But i cannot see where the problem is
import arcpy, os
env.workspace = arcpy.GetParameterAsText(0)
fcs = arcpy.ListFeatureClasses("ev*", "point")
for fc in fcs:
fields = arcpy.ListFields(fcs, "P10*", "Double")
for fld in fields:
fc_sort = "{0}_{1}.shp".format(os.path.splitext(fc)[0], fld.name)
arcpy.Sort_management(fc, fc_sort, [[fld.name, "ASCENDING"]])
I get that error
Traceback (most recent call last):
File "C:\Users\Kostas\Desktop\Xander.py", line 5, in <module>
fields = arcpy.ListFields(fcs, "P10*", "Double")
File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\__init__.py", line 1119, in ListFields
return gp.listFields(dataset, wild_card, field_type)
File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\geoprocessing\_base.py", line 344, in listFields
self._gp.ListFields(*gp_fixargs(args, True)))
IOError: "[u'evsamp10c10.shp', u'evsamp10c20.shp', u'evsamp10c30.shp', u'evsamp10c40.shp', u'evsamp10c50.shp', u'evsamp10c60.shp', u'evsamp10cb.shp', u'evsamp10cm10.shp', u'evsamp10cm20.shp', u'evsamp10cm30.shp', u'evsamp10cm40.shp', u'evsamp10cm50.shp', u'evsamp10cm60.shp', u'evsort10.shp']" does not exist
Failed to execute