<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: List features in multiple workspaces then convert to point, BUT ignore some paths in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198487#M15243</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Something like this? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hopefully, you have the same attribute names, type, etc in each of the FC's you are converting to point. Then, you would create an empty FC with the attribute table already set up and just append to it without having to worry about field mappings.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;will call it appendFC for clarity.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, os

#Set the workspace
workspace = r"D:/Work"

appendFC = r"C:\TEMP\PDX_SAB\PDX_SAB.gdb\appendFC"
outFC = r"\\in_memory\centerPoints"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # make this an in memory dataset is faster.&amp;nbsp; no need to write to disk if you are just deleting it.


#create list of files from directories and subdirectories
for root, dirs, files in arcpy.da.Walk(workspace, datatype="FeatureClass", type="Polygon"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; for name in files:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if name.startswith("APE") or name.startswith("SAB"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path = os.path.abspath(os.path.join(root, name))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for x in path:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "ARCHIVE" not in x:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # empty the output feature class before adding new data
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(outFC):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(outFC)&amp;nbsp; # if you are emptying it always, no need to check for size, just delete it if exists.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # convert to points
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureToPoint_management(path, outFC, "INSIDE")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # append to final FC
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Append_management(outFC, appendFC)

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 16:10:24 GMT</pubDate>
    <dc:creator>RhettZufelt</dc:creator>
    <dc:date>2021-12-12T16:10:24Z</dc:date>
    <item>
      <title>List features in multiple workspaces then convert to point, BUT ignore some paths?</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198486#M15242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have this code to loop through a workspace and find all shps and feature classes that are named a certain thing. I'd like to convert each poly to a point and then append it to a feature class, BUT I want to skip over any feature that has the word "ARCHIVE" in it's path. Any tips on how to do this would be great! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;BTW, the code fails so far. My final loop is merely taking the first letter of my output and doing the rest, instead of taking the actual feature class. I.e. it is telling me that "D_pt" does not exist. I know the path works, that is if I print it lists what I need it to list (all feature classes and shps that start with "APE" or "SAB") but then I can't do anything with it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy, os&amp;nbsp; #Set the workspace workspace = r"D:/Work"&amp;nbsp; #create list of files from directories and subdirectories for root, dirs, files in arcpy.da.Walk(workspace, datatype="FeatureClass", type="Polygon"): &amp;nbsp;&amp;nbsp;&amp;nbsp; for name in files: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if name.startswith("APE") or name.startswith("SAB"): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path = os.path.abspath(os.path.join(root, name)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for x in path: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFC = x + "_pt" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # convert to points &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureToPoint_management(path, outFC, "INSIDE") &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 17:34:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198486#M15242</guid>
      <dc:creator>SWCASWCA</dc:creator>
      <dc:date>2013-07-31T17:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198487#M15243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Something like this? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hopefully, you have the same attribute names, type, etc in each of the FC's you are converting to point. Then, you would create an empty FC with the attribute table already set up and just append to it without having to worry about field mappings.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;will call it appendFC for clarity.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, os

#Set the workspace
workspace = r"D:/Work"

appendFC = r"C:\TEMP\PDX_SAB\PDX_SAB.gdb\appendFC"
outFC = r"\\in_memory\centerPoints"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # make this an in memory dataset is faster.&amp;nbsp; no need to write to disk if you are just deleting it.


#create list of files from directories and subdirectories
for root, dirs, files in arcpy.da.Walk(workspace, datatype="FeatureClass", type="Polygon"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; for name in files:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if name.startswith("APE") or name.startswith("SAB"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path = os.path.abspath(os.path.join(root, name))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for x in path:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "ARCHIVE" not in x:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # empty the output feature class before adding new data
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(outFC):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(outFC)&amp;nbsp; # if you are emptying it always, no need to check for size, just delete it if exists.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # convert to points
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureToPoint_management(path, outFC, "INSIDE")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # append to final FC
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Append_management(outFC, appendFC)

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:10:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198487#M15243</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-12T16:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198488#M15244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;wasn't sure what/why you were hacking the paths and such, but after re-reading, I think you are just trying to process the polygons that start with SAB or APE if they are not in a directory named "ARCHIVE".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this is true, try something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, os

#Set the workspace
workspace = r"D:/Work"

appendFC = r"C:\TEMP\PDX_SAB\PDX_SAB.gdb\appendFC"
outFC = r"\\in_memory\centerPoints"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # make this an in memory dataset is faster.&amp;nbsp; no need to write to disk if you are just deleting it.


#create list of files from directories and subdirectories
for dirpath, dirnames, filenames in arcpy.da.Walk(workspace,topdown=True, datatype="FeatureClass", type="Polygon"):

&amp;nbsp;&amp;nbsp; if "ARCHIVE" in dirnames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dirnames.remove('ARCHIVE')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; for filename in filenames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if filename.startswith("APE") or filename.startswith("SAB"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(outFC):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(outFC)&amp;nbsp; # if you are emptying it always, no need to check for size, just delete it if exists.

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # convert to points
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureToPoint_management(os.path.join(dirpath,filename), outFC, "INSIDE")

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # append to final FC
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Append_management(outFC, appendFC)&amp;nbsp;&amp;nbsp; 
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If "ARCHIVE" is not a folder, but is included in a folder path somewhere, you could still put the if "ARCHIVE" not in code from my previous post.&amp;nbsp; If it is a folder, the way I have it coded, it should removed that directory before walking through the FCs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:54:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198488#M15244</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T09:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198489#M15245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks! I had just discovered the dirnames.remove feature. And yes, ARCHIVE is a subdirectory.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am getting an error though: "ExecuteError: ERROR 000210: Cannot create output \\in_memory\centerPoints&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (FeatureToPoint)."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, os

#Set the workspace
in_workspace = r"D:\Projects"
appendFC = r"C:\TEMP\PDX_SAB\PDX_SAB.gdb\appendFC"
# make an in memory dataset its faster.&amp;nbsp; no need to write to disk if you are just deleting it.
outFC = r"\\in_memory\centerPoints"

#create list of files from directories and subdirectories
for dirpath, dirnames, filenames in arcpy.da.Walk(in_workspace, datatype="FeatureClass",type="Polygon"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; # disregard any folder named "ARCHIVE" in creating list
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "ARCHIVE" in dirnames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dirnames.remove('ARCHIVE')

&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in filenames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if filename.startswith("APE") or filename.startswith("SAB"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(outFC):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(outFC)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # convert to points&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureToPoint_management(os.path.join(dirpath, filename), outFC, "INSIDE")

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # append to final FC
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Append_management(outFC, appendFC)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, how do I get it to print (maybe to a text file?) the paths? I want to use that to make sure I'm only appending the ones I want, in case I need to add additional exceptions (like the ARCHIVE folder). Do I just put 'print filename' after the if filename startswith line?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:54:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198489#M15245</guid>
      <dc:creator>SWCASWCA</dc:creator>
      <dc:date>2021-12-11T09:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198490#M15246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks! I had just discovered the dirnames.remove feature. And yes, ARCHIVE is a subdirectory.&lt;BR /&gt;&lt;BR /&gt;I am getting an error though: "ExecuteError: ERROR 000210: Cannot create output \\in_memory\centerPoints&lt;BR /&gt;Failed to execute (FeatureToPoint)."&lt;BR /&gt;&lt;BR /&gt;Also, how do I get it to print (maybe to a text file?) the paths? I want to use that to make sure I'm only appending the ones I want, in case I need to add additional exceptions (like the ARCHIVE folder). Do I just put 'print filename' after the if filename startswith line?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My bad, try this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
outFC = "in_memory\\centerPoints"

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;yes, print filename after the startswith line at the same indentation level as the if ArcpyExists to print to the console.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;could put print os.path.join(dirpath, filename) if you want the entire path/filename.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To print to a text file, you need to open it in write mode and write to it.&amp;nbsp; Here is an example of some of my code that writes results to a text file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
with open('D:/update/temp.txt','a',0) as f:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ### the "a" tells it to append to existing file.&amp;nbsp; "w" for write would create a new file, even if it exists.

&amp;nbsp; print dt
&amp;nbsp; f.write(dt)
&amp;nbsp; f.write("\n\nthis is first line of image_tables.py \n\n")

 # Process: Delete


&amp;nbsp; if arcpy.Exists(Images_full):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "deleting ",Images_full
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write("\ndeleting ")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write(Images_full)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(Images_full, "Table")

&amp;nbsp; if arcpy.Exists(WasteSitePoly_centroids):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "deleting ",WasteSitePoly_centroids
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write("\ndeleting ")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write(WasteSitePoly_centroids)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(WasteSitePoly_centroids)



f.close&amp;nbsp;&amp;nbsp;&amp;nbsp; # at the same indentation level as the with open line
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Since I opened it as "f"&amp;nbsp; (with open as f), then f.write are the statements that write to the file, the print just echos to the screen, so, what is printed to the screen is also written to the text file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;a print statement automatically indexes to a new line when you hit enter, the f.write statements, the \n adds a new line, otherwise, it just concatenates one long line.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:54:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198490#M15246</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T09:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198491#M15247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Again, many thanks for the code! Is there a particular place I have to put the write to text file code? I imagine the f.write line has to go after the print statement but what about all the stuff at the beginning?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I think it's working, but I did forget that I am not keeping any of the fields once I've converted to a point. I do want to capture the original path, and also a small portion of the path, and calc them to two attribute fields in the appendFC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So for example, for the following paths:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;D:\Projects\12345_XXX\SHP\APE.shp&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;D:\Projects\34567_XXX\GDB\MyGDB.gdb\SAB&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would want two records in my appendFC where the ProjNum field has been calc'd to be 12345 and 34567 respectively. I'm trying to capture it with this code but it isn't working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, os

#Set the workspace
in_workspace = r"D:\Projects"
appendFC = r"C:\TEMP\PDX_SAB\PDX_SAB.gdb\PDX_SAB_Centerpoint"
# make an in memory dataset its faster.&amp;nbsp; no need to write to disk if you are just deleting it.
outFC = "in_memory\\centerPoints"

# create list of files from directories and subdirectories
for dirpath, dirnames, filenames in arcpy.da.Walk(in_workspace, datatype="FeatureClass",type="Polygon"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; # disregard any folder named "ARCHIVE" in creating list
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "ARCHIVE" in dirnames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dirnames.remove('ARCHIVE')

&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in filenames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if filename.startswith("APE") or filename.startswith("SAB"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print os.path.join(dirpath, filename)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(outFC):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(outFC)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # convert to points&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureToPoint_management(os.path.join(dirpath, filename), outFC, "INSIDE")

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # add field to capture project number
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(outFC, "ProjectNum", "TEXT", "", "", 20, "", "NULLABLE", "REQUIRED")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(outFC, "OriginalPath", "TEXT", "", "", 255, "", "NULLABLE", "REQUIRED")

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # extract ProjectNum from path and calc fields
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exp = str(os.path.join(dirpath, filename)[9:13])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(outFC, "ProjectNum", os.path.join(dirpath, filename), '"' + exp + '"', "PYTHON")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(outFC, "OriginalPath", os.path.join(dirpath, filename), "PYTHON")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # delete fields; use ListFields to get a list of field objects
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldObjList = arcpy.ListFields(outFC)
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create an empty list that will be populated with field names&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldNameList = []
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # For each field in the object list, add the field name to the
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #&amp;nbsp; name list.&amp;nbsp; If the field is required, exclude it, to prevent errors
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for field in fieldObjList:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not field.required:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldNameList.append(field.name)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # delete field
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteField_management(outFC, fieldNameList)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # append to final FC
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Append_management(outFC, appendFC)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm getting this error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:/TEMP/PDX_SAB/SAB_Python.py", line 31, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(outFC, "ProjectNum", os.path.join(dirpath, filename), '"' + exp + '"', "PYTHON")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 3129, in CalculateField&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000800: The value is not a member of VB | PYTHON | PYTHON_9.3.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (CalculateField).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:54:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198491#M15247</guid>
      <dc:creator>SWCASWCA</dc:creator>
      <dc:date>2021-12-11T09:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198492#M15248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;the error is related to your expression.&amp;nbsp; Often I find it is easier to create the expression string as a variable and pass this way.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;this is working for me:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy, os&amp;nbsp; #Set the workspace in_workspace = r"D:\Projects" appendFC = r"C:\TEMP\PDX_SAB\PDX_SAB.gdb\PDX_SAB_Centerpoint" # make an in memory dataset its faster.&amp;nbsp; no need to write to disk if you are just deleting it. outFC = "in_memory\\centerPoints"&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with open(r'D:/Projects/temp.txt','w',0) as f:&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; # create list of files from directories and subdirectories &amp;nbsp;&amp;nbsp;&amp;nbsp; for dirpath, dirnames, filenames in arcpy.da.Walk(in_workspace, datatype="FeatureClass",type="Polygon"): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # disregard any folder named "ARCHIVE" in creating list &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "ARCHIVE" in dirnames: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dirnames.remove('ARCHIVE')&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in filenames: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if filename.startswith("APE") or filename.startswith("SAB"): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print os.path.join(dirpath, filename) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write(os.path.join(dirpath, filename)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write("\n") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(outFC): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(outFC)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # convert to points&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureToPoint_management(os.path.join(dirpath, filename), outFC, "INSIDE")&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # add field to capture project number &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(outFC, "ProjectNum", "TEXT", "", "", 20, "", "NULLABLE", "REQUIRED") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(outFC, "OriginalPath", "TEXT", "", "", 255, "", "NULLABLE", "REQUIRED")&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # extract ProjectNum from path and calc fields &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exp = str(os.path.join(dirpath, filename)[9:13]) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exp2 = str(os.path.join(dirpath, filename)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(outFC, "ProjectNum","exp", "PYTHON_9.3") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(outFC, "OriginalPath","exp2" ,"PYTHON_9.3")&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # delete fields; use ListFields to get a list of field objects &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldObjList = arcpy.ListFields(outFC)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create an empty list that will be populated with field names&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldNameList = []&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # For each field in the object list, add the field name to the &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #&amp;nbsp; name list.&amp;nbsp; If the field is required, exclude it, to prevent errors &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for field in fieldObjList: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not field.required: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldNameList.append(field.name)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # delete field &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteField_management(outFC, fieldNameList)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # append to final FC &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Append_management(outFC, appendFC) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write("done with script \n") f.close&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I took the liberty to add the file writes to your script.&amp;nbsp; Basically, after the with open statement, the file is open for writing as "f".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;so, anytime between the with open, and the f.close if you do a f.write() statement, it will write it to the text file.&amp;nbsp; f.close has to be at same indentation as the with open.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You now have example of how to write a variable, a new row, and text (with new row).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, do you use modelbuider?&amp;nbsp; For this kind of script, my initial approach would be to create a model in arcmap to perform this on just one FC and not worry about iterating.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, in the model, I would pull in the FeatureToPoint tool and convert to in_memory FC&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;then I'd pull in two AddField tools and configure to create both the fields&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;then pull in two calculateField tools and configure both&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;then would pull in the Append tool and configure to append to the appendFC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;now, run the model and make sure it works.&amp;nbsp; If you get errors, fix them until the model runs correctly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Now, File menu, export, export to python script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now you have a starting point, with the proper syntax for most the tools and all you have to do is add the da.walk iterator stuff to make it work on multiples.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 23:24:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198492#M15248</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2013-07-31T23:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198493#M15249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You are right - I went about this sort of backwards. I'm trying to learn more Python and thought the iteration was the place to start (just finding and 'gathering' all the data I needed to work with before doing anything with it). Your suggestion to start with model builder is a good one.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the write to text code too! That is all new to me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you tell me why you switched from "PYTHON" to "PYTHON_9.3" in the Calc Field expression? Is that so you can use "exp" without having to escape the quotation marks? From reading other posts I was under the impression that because exp and exp2 were strings they couldn't be used as variables without formatting them as '"' + exp + '"'. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Even using model builder I still can't get the expression right to calc the path to a field. I tried the parse path but either I'm not using it right or that is not it's intention.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Back in the python script I have a feeling the script is not running in the order I specified. I keep getting an error message about the schemas not matching to do the append. When I try printing the fields after the delete statement I see all the original fields - meaning no new fields were added and calc'd, and the old fields were not deleted.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How do I ensure that the processes run in the order I've put them in the script?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Aug 2013 16:22:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198493#M15249</guid>
      <dc:creator>SWCASWCA</dc:creator>
      <dc:date>2013-08-01T16:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198494#M15250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; &lt;BR /&gt;Can you tell me why you switched from "PYTHON" to "PYTHON_9.3" in the Calc Field expression? Is that so you can use "exp" without having to escape the quotation marks? From reading other posts I was under the impression that because exp and exp2 were strings they couldn't be used as variables without formatting them as '"' + exp + '"'. &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Because it seems that is the one I can ususally get to work as expected. Guess I'm getting used to haveing objects returned rather than strings.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; â?¢To calculate strings to text or character fields, in the dialog box the string must be double-quoted ("string"),&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;or in scripting, the double-quoted string must also be encapsulated in single quotes ('"string"').&lt;/STRONG&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Otherwise, just encapulated in a single set of double quotes passes the variable. Not sure where the + exp + comes from.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Basically, the expression needs the quote around it when it gets passed to calcfield. If you didn't put the double quotes around exp2 in the calcfiled line, you would have to include them in the exp2 string, and since that is a calculation, would have to concatenate them on there. Easier to just pass them around the exp variable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
exp2 = '"' + str(os.path.join(dirpath, filename)) + '"'
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;If you used that for your exp2 variable, it would include the double quotes, so in the calcfield you would just put exp2 without the double quotes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this makes sense.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; &lt;BR /&gt;Even using model builder I still can't get the expression right to calc the path to a field. I tried the parse path but either I'm not using it right or that is not it's intention.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so, what are you getting for the print os.path.join(dirpath, filename), or what is getting written to the text file for this value? The way I have it, it will return my path u'd:\\working.gdb\dataset' which I wrap in a str() for my exp2 variable. Oh heck, now I see an error in my code that could be causing this (breaking it for sure).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Change this:
exp2 = str(os.path.join(dirpath, filename)

to this:
exp2 = str(os.path.join(dirpath, filename)&lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;)&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After that, see if it works, if not, let me know what the print statements say. Actually, the one that matters is, what does&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print exp2 report?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, noticed you have set the field lenth to 255, are you sure your path(s) are not exceeding that length? In ArcMap, it will warn you and truncate, not sure how it handles that in code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; &lt;BR /&gt;Back in the python script I have a feeling the script is not running in the order I specified. I keep getting an error message about the schemas not matching to do the append. When I try printing the fields after the delete statement I see all the original fields - meaning no new fields were added and calc'd, and the old fields were not deleted.&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;How do I ensure that the processes run in the order I've put them in the script?&amp;nbsp; &lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unless you are redirecting it somewhere (sending it to a def()), it will run line by line, so the order is the same. You are not redirecting, so it will do line by line, except, of course where you loop through using for statements.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I suspect that you are running into this issue for append:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; Specifies if the schema (field definitions) of the input datasets must match the schema of the target dataset in order for data to be appended.&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;â?¢TEST â??Input dataset schema (field definitions) must match the schema of the target dataset. An error will be returned if the schemas do not match.&amp;nbsp;&amp;nbsp; &lt;BR /&gt;â?¢NO_TEST â??Input dataset schema (field definitions) do not have to match that of the target dataset. Any fields from the input datasets that do not match the fields of the target dataset will not be mapped to the target dataset unless the mapping is explicitly set in the Field Map control.&amp;nbsp; &lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First, have you ensured that there is an existing point FC named C:\TEMP\PDX_SAB\PDX_SAB.gdb\PDX_SAB_Centerpoint that has two text fields (and is in writeable workspace, and not being viewed in ArcMap or Catalog by anyone (otherwise, lock file..)).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One named ProjectNum with size 20&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;one named OriginalPath with size 255&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And then try this for you append line&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.Append_management(outFC, appendFC, "NO_TEST", "", "")&lt;/PRE&gt;&lt;SPAN&gt; see if that gets past the schema issues. With the NO_TEST, it should copy the attributes that match exactly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:54:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198494#M15250</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T09:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198495#M15251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well, I ended up figuring it out and as is usually the case with code (that I've found) it all comes down to syntax: quotes, double quotes, = vs ==, etc. I gave up using model builder, as I couldn't figure out the error messages I was getting. I found the errors in the python script to be much easier to work through.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again for all your invaluable help! Now on to tackling why it creates multiple points each time . . .&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Final code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, os

#Set the workspace
in_workspace = r"C:\TEMP\PDX_SAB"
appendFC = r"C:\TEMP\PDX_SAB\PDX_SAB.gdb\PDX_SAB_Centerpoint"
# make an in memory dataset its faster.&amp;nbsp; no need to write to disk if you are just deleting it.
outFC = "in_memory\\centerPoints"

with open(r'C:\TEMP\PDX_SAB\paths.txt','w',0) as f:

&amp;nbsp;&amp;nbsp;&amp;nbsp; # create list of files from directories and subdirectories
&amp;nbsp;&amp;nbsp;&amp;nbsp; for dirpath, dirnames, filenames in arcpy.da.Walk(in_workspace, datatype="FeatureClass",type="Polygon"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # disregard any folder named "ARCHIVE" in creating list
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "ARCHIVE" in dirnames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dirnames.remove('ARCHIVE')

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in filenames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if filename.startswith("APE") or filename.startswith("SAB"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #if filename.name == "APE" or filename.name == "SAB":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print os.path.join(dirpath, filename)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write(os.path.join(dirpath, filename))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write("\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(outFC):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(outFC)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # convert to points&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureToPoint_management(os.path.join(dirpath, filename), outFC, "INSIDE")

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # add field to capture project number
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(outFC, "ProjectNum", "TEXT", "", "", 20, "", "NULLABLE", "REQUIRED")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(outFC, "OriginalPath", "TEXT", "", "", 255, "", "NULLABLE", "REQUIRED")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(outFC, "ServiceArea", "TEXT", "", "", 75, "", "NULLABLE", "REQUIRED")

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # set expressions to calculate fields
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exp = str(os.path.join(dirpath, filename)[16:21])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exp2 = str(os.path.join(dirpath, filename))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if filename.startswith("APE"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exp3 = "Cultural"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exp3 = "Natural"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(outFC, "ProjectNum", "exp", "PYTHON_9.3")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(outFC, "OriginalPath", "exp2", "PYTHON_9.3")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(outFC, "ServiceArea", "exp3", "PYTHON_9.3")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # delete fields; use ListFields to get a list of field objects
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldObjList = arcpy.ListFields(outFC)
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create an empty list that will be populated with field names&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldNameList = []
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # For each field in the object list, add the field name to the
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # name list.&amp;nbsp; If the field is required, exclude it, to prevent errors
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for field in fieldObjList:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not field.required:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #if field.name != "ProjectNum" and field.name != "OriginalPath":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldNameList.append(field.name)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # delete field
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteField_management(outFC, fieldNameList)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # append to final FC
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Append_management(outFC, appendFC)
&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write("done with script \n")
f.close
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:54:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198495#M15251</guid>
      <dc:creator>SWCASWCA</dc:creator>
      <dc:date>2021-12-11T09:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198496#M15252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So, what are your polygon datasets in "C:\TEMP\PDX_SAB" ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You are not doing a selection or anything, so it should make a point for each polygon feature from each input dataset.&amp;nbsp; If you have more than one polygon in the FC, you will get more than one point.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this what is going on, or are you getting&amp;nbsp; the same point entered multiple times?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Aug 2013 19:25:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198496#M15252</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2013-08-01T19:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198497#M15253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yep, you nailed it - multiple records of the same shape (I think someone used it for data driven pages). Fixed with a delete_identical.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would love to know if there are better/faster ways of doing what I'm doing - either cleaner code or better functions/processes. If this is iterating through a very large workspace with hundreds of folders and subdirectories I can see it really bogging a machine down. TThe in_memory space for example - I never would have thought of it (had never heard of it) and it's really a nice lightweight approach.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Aug 2013 19:41:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198497#M15253</guid>
      <dc:creator>SWCASWCA</dc:creator>
      <dc:date>2013-08-01T19:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198498#M15254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well, your script is stand alone, and not controlling a map document, so don't think the data driven pages has anything to do with it.&amp;nbsp; you are working with the FC's directly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From what you have told me, perhaps each polygon feature class has duplicate polygons?&amp;nbsp; In the attribute table of the polygon FC, in ArcMap, how many records do you see?&amp;nbsp; each one would be made to a point.&amp;nbsp; If you are getting identical points, probably identical polygons.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is real common if the data at one time came from autoCAD.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As far as a different approach, not sure if it would be faster, but here is one method.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Create a list of all the input polygon FC's, iterate them&amp;nbsp; and add your fields to them directly, calculate the fields to thier respective source.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then, since you already have the list, use that as the input to&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.Merge_management(fcList, outFC)&amp;nbsp; #&amp;nbsp; not sure if you would need to deal with field mappings.&amp;nbsp; I think it will keep all fields that have identical schema.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then, run the FeatureToPoint on the outFC and do it all in one swoop.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Like I said, not sure if it would speed it up or not, but I have noticed that the append tool is very slow, and involking it each loop could be painfully slow.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Aug 2013 21:06:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198498#M15254</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2013-08-01T21:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198499#M15255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry to be confusing in my earlier post. I meant that the original poly had multiple records in it that someone had used for data driven pages (my guess) and that was why I was getting multiple identical points. The delete_identical worked great for removing those.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would likely have to deal with different schemas, so it may make sense to add and delete fields one by one before appending, though it sounds like the time hang up may be in the append itself?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will also at some point have to address the issue that the original polys are in different projections as well but . . . baby steps. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Aug 2013 21:54:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198499#M15255</guid>
      <dc:creator>SWCASWCA</dc:creator>
      <dc:date>2013-08-01T21:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198500#M15256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;OIC.&amp;nbsp; I thought you were running the deleteIdenticals on the final appendFC, but sounds like you used it to "fix" the polygons.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Don't think the different schemas would matter as long as the fields you are concerned about are identical.&amp;nbsp; I.e., if you add your three fields to each polygon FC first.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now that I think about it (even more), this is what I would try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;merge will add them all together and add all fields from all input FC's.&amp;nbsp; Will combine them if they are identical.&amp;nbsp; So, if they have the three identical fields that you are interested in, the rows will be populated with the attributes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

appendFC = r"C:\TEMP\PDX_SAB\PDX_SAB.gdb\PDX_SAB_Centerpoint"

outFC = "in_memory\\centerPoints"

tmpFC= "in_memory\\tmpFC"

fieldList = ["ProjectNum",&amp;nbsp; "OriginalPath",&amp;nbsp; "ServiceArea"]
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ##Merge tool will honor the coordinate system of the first FC in the list to be merged, so I'd make my list something like:
fcList = ["baseFC"]&amp;nbsp;&amp;nbsp; # where BaseFC is a FC in your workspace that is in the correct coordinate system, this will set the output to the SR you want

layerList = []

then, after you do your walk,
for all file in filenames:
&amp;nbsp;&amp;nbsp; fcList.append("file")

for all fcs in fcList:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ## these two look like duplication, but this is how I add to a list with a value already.&amp;nbsp; For file in filenames is a list I can't control this way
&amp;nbsp;&amp;nbsp; layername = str(fcs) + "feature_layer"
&amp;nbsp;&amp;nbsp; layerList.append(layername)&amp;nbsp;&amp;nbsp;&amp;nbsp; # append the new in memory layer names to a list so we can utilize it after iteration.

&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(fcs,layername)&amp;nbsp;&amp;nbsp; # this will put them as in memory layers and are fast

&amp;nbsp;&amp;nbsp; arcpy.AddField_management(layername, "ProjectNum", "TEXT", "", "", 20, "", "NULLABLE", "REQUIRED")
&amp;nbsp;&amp;nbsp; arcpy.AddField_management(layername, "OriginalPath", "TEXT", "", "", 255, "", "NULLABLE", "REQUIRED")
&amp;nbsp;&amp;nbsp; arcpy.AddField_management(layername, "ServiceArea", "TEXT", "", "", 75, "", "NULLABLE", "REQUIRED")

&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(layername, "ProjectNum", "exp", "PYTHON_9.3")
&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(layername, "OriginalPath", "exp2", "PYTHON_9.3")
&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(layername, "ServiceArea", "exp3", "PYTHON_9.3")


Now, after iterating through all FC, and making the list of feature layers, combine them all so we can do the rest in one swoop.
&amp;nbsp;&amp;nbsp; 
arcpy.Merge_management(layerList, tmpFC)&amp;nbsp;&amp;nbsp; ### merges all the polygon in memory fc's with new calculated fields into an in memory fc

fields = arcpy.ListFields(tmpFC)

for field in fields:
&amp;nbsp;&amp;nbsp; if field not in fieldList:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteField_management (tmpFC, field)&amp;nbsp; ## will drop all the "extra" fields if not in the fieldsList.

arcpy.FeatureToPoint_management(tmpFC, appendFC, "INSIDE")&amp;nbsp;&amp;nbsp; ## this will make point FC in same SR as first input with your three fields appended.



&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;unless you run out of memory or something, I think this approach would be much faster.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Of course, this is just the basic outline, you would need to incorporate the expression code and such in there, so this code isn't "run ready"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, as far as converting the SR of the polygons, if you have the need to convert them for some other reason, then probably worth doing that first.&amp;nbsp; however, both append and merge will honor coordinate systems (if defined) and will on the fly re-project them to the ouput datasets SR&amp;nbsp; (to the SR of first input for Merge).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;also, could easily skip the two list builders if you make sure that the first one being read to your list is in the proper SR.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:54:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198500#M15256</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T09:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198501#M15257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Didn't know about the reproject-on-the-fly with the append and merge commands - good info.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Am trying this but am a bit confused about something - is the for fcs in fcList nested within for file in filenames? Or are they distinct for loops? If they are distinct, how can I rewrite the first two expressions used in the CalculateField command? Right now I have the for loops separated/distinct but then I get an error that 'filename' is not defined when setting up exp and exp2, obviously because it no longer exists outside of it's for loop. Do I use the items in fcList somehow instead?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Aug 2013 16:14:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198501#M15257</guid>
      <dc:creator>SWCASWCA</dc:creator>
      <dc:date>2013-08-05T16:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198502#M15258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Melissa,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The for file in filenames just takes the output in filenames (from da.walk) and appends them into a new list.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The for fcs in fcList then iterates through this new list, so they are completely independant of one another.&amp;nbsp; I did it this way so I could control the order of the list and ensure that baseFC is ALWAYS the first in the list so that merge pulls the spatial reference from that layer.&amp;nbsp; If there were an easy way to just add that FC to the beginning of the original filenames list, would just use the one loop instead.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Instead of using filename in your exp statement(s), use fcs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;exp2 = str(os.path.join(dirpath, fcs))
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:54:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198502#M15258</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T09:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198503#M15259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Melissa,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Was in a hurry when I posted that, and wasn't sure if the filenames list from da.walk is a "normal" python list, so wasn't sure if insert would work correctly.&amp;nbsp; But, after testing, I see that it does.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could have done it this way:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
baseFC = r"c:\pathto\dataset&amp;nbsp; ##&amp;nbsp;&amp;nbsp;&amp;nbsp; set to FC that has the desired output SR


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ## then, after you do your da.walk,
filenames.insert(0,baseFC)&amp;nbsp;&amp;nbsp;&amp;nbsp; ##&amp;nbsp; this would ensure the baseFC is the first in the list when passing it to the merge function
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then, you could use the original code (for file in filenames: ) rather than having to use the (for fcs in fcList)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Either way works, but this method is more "clean",&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:54:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198503#M15259</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T09:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: List features in multiple workspaces then convert to point, BUT ignore some paths</title>
      <link>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198504#M15260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just getting back to this after being out of town.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am now getting a runtime error on the DeleteField_management(tmpFC, field) statement and I'm not sure why. It doesn't give me any clue other than 'error in executing tool'.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think I am confused by when 'layername' is used and when 'layerList' is used. The layername are appended to layerList early in the script, but then layername is used for adding and calculating fields. Yet, layerList is then used for deleting fields?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Again, thanks for your patience.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2013 16:09:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-features-in-multiple-workspaces-then-convert/m-p/198504#M15260</guid>
      <dc:creator>SWCASWCA</dc:creator>
      <dc:date>2013-08-27T16:09:29Z</dc:date>
    </item>
  </channel>
</rss>

