Using da.Walk to discover feature datasets throughout a series of subfolders

09-29-2016 06:31 AM
Occasional Contributor III

Hi, so here's what I'm trying to do.  I have a parent folder, which I'm calling my workspace.  Under that folder are several subfolders, each containing one file geodatabase.  Each file geodatabase contains unique feature datasets that I'm trying to merge into one final file geodatabase.

I'm stuck at building the list of the feature datasets.  Here's the code in question:

folder = "C:\\Temp\\Extracted"

walk = arcpy.da.Walk(folder, datatype="FeatureDataset")
    for dirpath, workspaces, datatypes in walk:
        for datatype in datatypes:

This code yields *everything* in the subdirectory structure down to the feature dataset level.  It lists all folder names, all file geodatabases at the .gdb level, and all feature datasets.

What I'm trying to do is get a list back of *only* feature datasets.  Can someone tell me where I'm going wrong?

Tags (2)
0 Kudos
13 Replies
MVP Esteemed Contributor

You think they will migrate ArcMap to Python 3.x?  You are a more hopeful man than I.

0 Kudos
MVP Emeritus

yes.  I don't know why they didn't do it for 10.4... but having said that, you just need to install PRO and you can work in both worlds.



and if you have an iPhone, iPad or any iThingy..... /blogs/dan_patterson/2016/06/17/python-35-comes-to-ithings 

0 Kudos
Esri Regular Contributor

Here is the steps on adding code blocks to GeoNet: 

To add to bixb0012‌ comments, can you post the output of your script, perhaps in a txt file?

0 Kudos
MVP Emeritus

Christian as well /blogs/dan_patterson/2016/08/14/script-formatting beyond the basic stuff as well

0 Kudos