AnsweredAssumed Answered

Rename a list of SHP files in Python

Question asked by franciscosobrado on Sep 8, 2015
Latest reply on Sep 8, 2015 by wwmiller68

Hello people,


I have a list of SHP files that I want to rename. First, I want to replace the "." from the shp to "_", and then rename the file. As you can see in the image below:



This the code that I am using:


import arcpy, os




for filename in arcpy.ListFeatureClasses():


    a=filename.replace('.', '_')


    arcpy.Rename_management(filename, a)


    print "ok"


The problem is that when I am trying to open the SHP file it does not work. I am getting the following error message:



Does anyone knows how to fix the problem...


Thanks for your help