Why is it that some (possibly most?) geoprocessing tools do not allow output shapefile names to start with a number (for example, Dissolve and Spatial Join), while others do (for example, Rename)? Also, why can you start a shapefile name with a number while exporting data (Data -> Export Data)? It does not seem to be a shapefile limitation, it seems to be a individual geoprocessing tool "check".
I ask because my organization's project numbers (surprise!) start with numbers, and it would make sense to start file names with the project number.
Message was edited by: Darren Wiens *This thread started off wondering why file names could not start with numbers, but it turns out they can.
I haven't check the standard interface but the Spatial join tool has no such reference to that limitation. Do you get an error message? If so a link should be provided in the help files describing the limitations. I know that dbase field names shouldn't begin with numbers, but I have never saved a shapefile with a starting number. You could use Proj_12345_roads.shp which would allow you to split file names on the "_" character and parse by class (Proj), class number (12345) and class type (roads)., however, I presume that this is a long standing method that you use.
After a little more investigation, I can in fact save the output of Spatial Join starting with a number. I cannot, however, save the output of Spatial Join with a name containing a dash character (our project numbers are like "14-P-575".).
The exact file name I would like to use is "14-P-0575_AgCap.shp". After running Spatial Join, naming the file as something like "AgCap.shp", I can then rename the file to "14-P-0575_AgCap.shp". Why does Spatial Join care if the name contains a dash?
From my understanding, various naming conventions are enforced so that ArcGIS can work with multiple data types. In some cases, a hyphen is an invalid character so ArcGIS tends to choke on them from time to time.
Check this link for a quick guide on naming conventions. I know this is for field names, but it's a good practice to keep your file names clean too.
The field names are fine. I'm not concerned with "the best ways" to name my files (our project numbers contain numbers and hyphens and there's not much I can do about it), I'm curious why some geoprocessing tools treat names as invalid, when they are not (i.e. I can rename the files to contain hyphens and as is well).
I am resurrecting this old post to see if anyone found a workaround for the limitation on the use of hyphens in an output shapefile when certain geoprocessing tools are used. I have an ArcMap project where selected features get exported to new shapefiles with dates using hyphens. It works fine and the result fits in with the naming format of hundreds of shapefiles. In ArcGIS Pro it doesn't work because Pro uses the Copy Features tool to do the same thing, and while it can read a shapefile with hyphens in its name as input, it cannot export to a shapefile with hyphens in its name. Same thing for the Feature to Polygon tool. This is not a big deal since I have the ArcMap project and can make a QGIS project from it, but it is just one more way Pro seems to delight in screwing up simple conversion of ArcMap projects to Pro projects.