<?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: Path Names in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/path-names/m-p/459769#M36021</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Really, you just need to iterate through each feature class, and concatenate the workspace, the feature dataset and feature class name together.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

import arcpy
import os
# Set the current workspace


gdbInput = "C:\Users\iamurray\Desktop\Test.gdb"
gdbOutput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\EmptyGisDeliverables_v14.gdb"

arcpy.env.workspace = gdbInput

# Create list of datasets in input gdb
dsInput = arcpy.ListDatasets()
#print dsInput

#Create list of fc in ds
for ds in dsInput:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fcInput = arcpy.ListFeatureClasses(feature_dataset=ds)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in fcInput:
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print gdbInput + "/" + ds + "/" + fc

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This gives me &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;C:\Users\iamurray\Desktop\Test.gdb/Test1/TestFC2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;C:\Users\iamurray\Desktop\Test.gdb/Test/TestFC&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 20:27:51 GMT</pubDate>
    <dc:creator>IanMurray</dc:creator>
    <dc:date>2021-12-11T20:27:51Z</dc:date>
    <item>
      <title>Path Names</title>
      <link>https://community.esri.com/t5/python-questions/path-names/m-p/459768#M36020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi folks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to get a list of path names for feature classes in a gdb. The gdb is configured something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Myfeatures.gdb&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Feature 1 Dataset&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]fc1, fc2,fc3 [/INDENT] &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Feature 2 Dataset&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]fc1, fc2,fc3 [/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Feature 3 Dataset&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]fc1, fc2,fc3 [/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;etc. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am having trouble getting right down to the FC for a path. I tried using the os.path.join function but it doesn't seem to like lists and an input. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what I have so far for code. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy import os # Set the current workspace&amp;nbsp;&amp;nbsp; gdbInput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\PIR_MR98copy.gdb" gdbOutput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\EmptyGisDeliverables_v14.gdb"&amp;nbsp; arcpy.env.workspace = gdbInput&amp;nbsp; # Create list of datasets in input gdb dsInput = arcpy.ListDatasets() #print dsInput&amp;nbsp; #Create list of fc in ds for ds in dsInput: &amp;nbsp;&amp;nbsp;&amp;nbsp; fcInput = arcpy.ListFeatureClasses(feature_dataset=ds) &amp;nbsp;&amp;nbsp;&amp;nbsp; print fcInput&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what I get for results from previous code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;[u'AppraisalPoint'] [u'BlockHubs', u'BlockPolygon'] [u'RoadLine', u'RoadCrossing', u'RoadNotes', u'RoadHubs'] [u'RiparianLine', u'Riparian_SMZ_Buffer', u'LakeWetland', u'LakeWetlandLine']&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Brett&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jun 2014 17:25:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/path-names/m-p/459768#M36020</guid>
      <dc:creator>BrettAuger1</dc:creator>
      <dc:date>2014-06-17T17:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: Path Names</title>
      <link>https://community.esri.com/t5/python-questions/path-names/m-p/459769#M36021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Really, you just need to iterate through each feature class, and concatenate the workspace, the feature dataset and feature class name together.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

import arcpy
import os
# Set the current workspace


gdbInput = "C:\Users\iamurray\Desktop\Test.gdb"
gdbOutput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\EmptyGisDeliverables_v14.gdb"

arcpy.env.workspace = gdbInput

# Create list of datasets in input gdb
dsInput = arcpy.ListDatasets()
#print dsInput

#Create list of fc in ds
for ds in dsInput:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fcInput = arcpy.ListFeatureClasses(feature_dataset=ds)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in fcInput:
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print gdbInput + "/" + ds + "/" + fc

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This gives me &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;C:\Users\iamurray\Desktop\Test.gdb/Test1/TestFC2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;C:\Users\iamurray\Desktop\Test.gdb/Test/TestFC&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:27:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/path-names/m-p/459769#M36021</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2021-12-11T20:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Path Names</title>
      <link>https://community.esri.com/t5/python-questions/path-names/m-p/459770#M36022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Really, you just need to iterate through each feature class, and concatenate the workspace, the feature dataset and feature class name together.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

import arcpy
import os
# Set the current workspace


gdbInput = "C:\Users\iamurray\Desktop\Test.gdb"
gdbOutput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\EmptyGisDeliverables_v14.gdb"

arcpy.env.workspace = gdbInput

# Create list of datasets in input gdb
dsInput = arcpy.ListDatasets()
#print dsInput

#Create list of fc in ds
for ds in dsInput:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fcInput = arcpy.ListFeatureClasses(feature_dataset=ds)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in fcInput:
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print gdbInput + "/" + ds + "/" + fc

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;This gives me &lt;BR /&gt;&lt;BR /&gt;C:\Users\iamurray\Desktop\Test.gdb/Test1/TestFC2&lt;BR /&gt;C:\Users\iamurray\Desktop\Test.gdb/Test/TestFC&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This seems to work for me too. However when I use a variable to collect the path names and use that variable as an input it only uses the last value. Is there a step that I need to do so the path names are returned in a list that can be used as an input for the next step. This is what I have so far again:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
import os
# Set the current workspace


gdbInput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\PIR_MR98copy.gdb"
gdbOutput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\EmptyGisDeliverables_v14.gdb"

arcpy.env.workspace = gdbInput

# Create list of datasets in input gdb
dsInput = arcpy.ListDatasets()
#print dsInput

#Create list of fc in ds
for ds in dsInput:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fcInput = arcpy.ListFeatureClasses(feature_dataset=ds)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in fcInput:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; list = [gdbOutput+ "/" + ds + "/" + fc]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print list

arcpy.env.workspace = gdbOutput
for path in list:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if not arcpy.Exists(path):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "no {}".format(path)
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "yes {}".format(path)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Brett&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:27:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/path-names/m-p/459770#M36022</guid>
      <dc:creator>BrettAuger1</dc:creator>
      <dc:date>2021-12-11T20:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Path Names</title>
      <link>https://community.esri.com/t5/python-questions/path-names/m-p/459771#M36023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Easiest thing to do would to create an empty list outside of your loop, then have each file path append itself to the list.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; import arcpy import os # Set the current workspace&amp;nbsp;&amp;nbsp; gdbInput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\PIR_MR98copy.gdb" gdbOutput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\EmptyGisDeliverables_v14.gdb"&amp;nbsp; arcpy.env.workspace = gdbInput&amp;nbsp; # Create list of datasets in input gdb dsInput = arcpy.ListDatasets() #print dsInput&amp;nbsp; #make empty list to append file paths to. fclist = []&amp;nbsp; #Create list of fc in ds for ds in dsInput: &amp;nbsp;&amp;nbsp;&amp;nbsp; fcInput = arcpy.ListFeatureClasses(feature_dataset=ds) &amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in fcInput: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filepath = [gdbOutput+ "/" + ds + "/" + fc] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fclist.append(filepath)&amp;nbsp; arcpy.env.workspace = gdbOutput for path in fclist: &amp;nbsp;&amp;nbsp;&amp;nbsp; if not arcpy.Exists(path): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "no {}".format(path) &amp;nbsp;&amp;nbsp;&amp;nbsp; else: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "yes {}".format(path) &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jun 2014 19:21:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/path-names/m-p/459771#M36023</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2014-06-17T19:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: Path Names</title>
      <link>https://community.esri.com/t5/python-questions/path-names/m-p/459772#M36024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This works smashingly. Thank you for your help. It is much appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Easiest thing to do would to create an empty list outside of your loop, then have each file path append itself to the list.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

import arcpy
import os
# Set the current workspace


gdbInput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\PIR_MR98copy.gdb"
gdbOutput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\EmptyGisDeliverables_v14.gdb"

arcpy.env.workspace = gdbInput

# Create list of datasets in input gdb
dsInput = arcpy.ListDatasets()
#print dsInput

#make empty list to append file paths to.
fclist = []

#Create list of fc in ds
for ds in dsInput:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fcInput = arcpy.ListFeatureClasses(feature_dataset=ds)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in fcInput:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filepath = [gdbOutput+ "/" + ds + "/" + fc]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fclist.append(filepath)

arcpy.env.workspace = gdbOutput
for path in fclist:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if not arcpy.Exists(path):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "no {}".format(path)
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "yes {}".format(path)

&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:27:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/path-names/m-p/459772#M36024</guid>
      <dc:creator>BrettAuger1</dc:creator>
      <dc:date>2021-12-11T20:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: Path Names</title>
      <link>https://community.esri.com/t5/python-questions/path-names/m-p/459773#M36025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Glad it worked for you!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jun 2014 19:37:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/path-names/m-p/459773#M36025</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2014-06-17T19:37:40Z</dc:date>
    </item>
  </channel>
</rss>

