Josh_Calhoun

How do I exclude a dataset from the ListDatasets collection

Discussion created by Josh_Calhoun on Nov 13, 2012
Latest reply on Nov 14, 2012 by rafaelr
Hi Everyone,

I would like to run a gp tool on a list of data sets in sde. I would however, like to exclude one data set called countours from the process if possible. Does anyone here know how that might be done? Any help you all can give me will be greatly appreciated. Below is an example of the code I am using.

thanks,

Josh Calhoun
City of Chattanooga, GIS


import arcpy
from arcpy import env
import time
import os

arcpy.env.workspace = (r'Database Connections\GADMIN.sde')

fgdb = (r'E:\ChattGIS.gdb')

arcpy.Delete_management(fgdb)

arcpy.CreateFileGDB_management(r'E:', "ChattGIS.gdb")

for ds in arcpy.ListDatasets("*","Feature"):
    print ds
    outds = fgdb +"\\"+ ds[16:]
    arcpy.Copy_management(ds, outds)
outparcelLocator = fgdb +"\\"+ "Parcels"
outstreetLocator = fgdb +"\\"+ "Streets"
arcpy.Copy_management ('Database Connections\GADMIN.sde\GADMIN.Parcels', outparcelLocator)
arcpy.Copy_management ('Database Connections\GADMIN.sde\GADMIN.Streets', outparcelLocator)

Outcomes