<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><p style="color: rgb(0, 0, 0);" class="MsoNormal">Sandell, <br></p><p style="color: rgb(0, 0, 0);" class="MsoNormal"><br></p><p style="color: rgb(0, 0, 0);" class="MsoNormal">We did something like this with some client legacy data recently--was 300+ folders, 1500 shapefiles. Depends if the destination field
classes have the same schema… could be done pretty quickly;</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> </p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal">Searching all folders can be
done a bit easier when you know what you’re looking for, in this case <span class="yshortcuts" id="lw_1258468729_0">File</span>
geodatabases.</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal">Though in this case you can’t
just start at the highest level since the destination rests in the same folder
structure… but something like this would work</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> - just some quick
sample code below, it’s not completed just showing an easy way to search the
folders...........<br></p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> </p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal">-// (forward slashes are
comments)</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> </p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal">C#</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> </p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal">//base path to folders</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal">string basePath = @”C:\myData\Land_Mgmt\”;</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> </p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal">//destination path</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal">string destinationPath = @”C:\myData\Land_Mgmt\Statewide\LeaseManagement.gdb”;</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> </p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal">//4 regions</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal">string[] foldersToSearch = {“Region_I”,
“Region_II”, “Region_III”, “Region_IV”};</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> </p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal">foreach (string folder in
foldersToSearch)</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal">{</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> //get all <span style="border-bottom: 1px dashed rgb(0, 102, 204); cursor: pointer;" class="yshortcuts" id="lw_1258468729_1">gdb
files</span> from folder(s) – searchoption will search all sub-folders</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> string
fileNames[] = Directory.GetFiles(basePath + folder, “*.gdb”,
SearchOption.AllDirectories);</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> </p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> foreach(string
file in filenames)</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> {</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> //create
a file object (easy reference to file)</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> FileInfo
pFileInfo = new FileInfo(file);</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> </p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> //open
the gdb</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> </p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> //have
a statement recursively opening the 6 featureclasses</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> </p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> //search
all features</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> </p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> //append
to destinationPath</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> </p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal"> }</p>
<p style="color: rgb(0, 0, 0);" class="MsoNormal">}</p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>
<div>
<p class="MsoNormal" style=""><span style="font-size: 12pt; color: rgb(31, 73, 125);">Thomas M. Bass<br>
Software Developer I <br>
</span><span style="color: rgb(31, 73, 125);"><a rel="nofollow" target="_blank" href="http://maps.google.com/maps?f=q&hl=en&geocode=&time=&date=&ttype=&q=landmark&sll=30.439609,-84.230032&sspn=0.020683,0.036392&ie=UTF8&ll=30.437907,-84.227843&spn=0.020683,0.036392&z=15&iwloc=A&om=1"><span class="yshortcuts" id="lw_1258468729_2">3059 Highland Oaks Terrace</span></a> <br>
</span><u><span style="color: blue;">Tallahassee, FL 32301</span></u><span style="color: rgb(31, 73, 125);"> (map) <br>
o <span style="border-bottom: 1px dashed rgb(0, 102, 204); cursor: pointer;" class="yshortcuts" id="lw_1258468729_3">850.385.3667 x3975</span> <br>
c <span style="border-bottom: 1px dashed rgb(0, 102, 204); cursor: pointer;" class="yshortcuts" id="lw_1258468729_4">850.559.9848</span> </span></p>
<p class="MsoNormal" style=""><span style="font-size: 12pt; color: rgb(31, 73, 125);"><a rel="nofollow" target="_blank" href="http://www.landmarksystems.com/applicationdevelopment"><span class="yshortcuts" id="lw_1258468729_5">Read about our
Forestry GIS Tools & Applications</span></a></span></p>
<p class="MsoNormal" style=""><span style="color: rgb(31, 73, 125);"><a rel="nofollow" ymailto="mailto:tbass@landmarksystems.com" target="_blank" href="mailto:tbass@landmarksystems.com"><span class="yshortcuts" id="lw_1258468729_6">mailto:tbass@landmarksystems.com</span></a><br>
<a rel="nofollow" target="_blank" href="http://www.landmarksystems.com/"><span class="yshortcuts" id="lw_1258468729_7">www.landmarksystems.com</span></a>
</span></p>
<p class="MsoNormal" style=""><span style="font-size: 8pt; color: rgb(31, 73, 125);">NOTICE: This communication is intended
only for the person or entity to whom it is addressed and may contain
confidential, proprietary, and/or privileged material. Unless you are the
intended addressee, any review, reliance, dissemination, distribution, copying
or use whatsoever of this communication is strictly prohibited. If you received
this in error, please reply immediately and delete the material from all
computers.</span></p>
</div><div> <br style="font-family: tahoma,new york,times,serif; font-style: italic;"></div><a rel="nofollow" style="font-style: italic;" target="_blank" href="http://www.flickr.com/photos/geo_idaeus/map/"><span style="font-family: tahoma,new york,times,serif;"></span></a><span style="font-family: tahoma,new york,times,serif;"><span style="text-decoration: underline;"></span></span><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> "Sandell, Keith M." <sandell.keith@mail.dc.state.fl.us><br><b><span style="font-weight: bold;">To:</span></b> shrug-l@lists.dep.state.fl.us<br><b><span style="font-weight: bold;">Sent:</span></b> Mon, November 16, 2009 3:57:52 PM<br><b><span style="font-weight: bold;">Subject:</span></b> shrug-l: Recursive
Searching<br></font><br>
<style>
<!--
_filtered {font-family:"Cambria Math";panose-1:2 4 5 3 5 4 6 3 2 4;}
_filtered {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;margin-bottom:.0001pt;font-size:11.0pt;font-family:"Calibri", "sans-serif";}
a:link, span.MsoHyperlink
        {color:blue;text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;text-decoration:underline;}
span.EmailStyle17
        {font-family:"Calibri", "sans-serif";color:windowtext;}
.MsoChpDefault
        {}
_filtered {margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {}
-->
</style>
<div class="Section1">
<p class="MsoNormal">Hey Shruggers,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span style="font-size: 11.5pt;">I need a way to search
through an undetermined number of folders and file geodatabases within these
folders for specific feature classes ("by name", 6 unique names) and
then append all the features from like feature classes into 6 feature classes
with the same unique names inside another file geodatabase. </span></p>
<p class="MsoNormal"><span style="font-size: 11.5pt;"> </span></p>
<p class="MsoNormal"><span style="font-size: 11.5pt;">I need to go from having 100
File GDBs, with a total of 600 feature classes and about 12,000 features -- to
having 1 FGDB with 6 feature classes with about 12,000 features…a user’s
sick joke. I told them when they started this project to use one gdb and
filter, but they insisted on having separate gdbs and now they want the ability
to periodically consolidate them.</span></p>
<p class="MsoNormal"><span style="font-size: 11.5pt;"> </span></p>
<p class="MsoNormal"><span style="font-size: 11.5pt;">I have a basic understanding
of the List methods for workspaces and feature classes, but I have yet to
figure out how to integrate the sys module’s capacity to recursively
search through folders and create the lists at the same time so that I can
append all 12,000 features to the 6 feature classes.</span></p>
<p class="MsoNormal"><span style="font-size: 11.5pt;"> </span></p>
<p class="MsoNormal"><span style="font-size: 11.5pt;">The attached bmp shows the
basic folder hierarchy that I am dealing with and where I want the data to flow
from and to.</span></p>
<p class="MsoNormal"><span style="font-size: 11.5pt;"> </span></p>
<p class="MsoNormal"><span style="font-size: 11.5pt;">Any thoughts would be greatly
appreciated.</span></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial","sans-serif";">Thanks</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial","sans-serif";"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial","sans-serif";">Keith
Sandell, MBA</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial","sans-serif";">Management
Analyst</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial","sans-serif";">Bureau
of Probation and Parole Field Services</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial","sans-serif";">Office
of Community Corrections</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial","sans-serif";">Florida
Department of Corrections</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial","sans-serif";">2601
Blair Stone Road</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial","sans-serif";">Tallahassee,
Florida 32399</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial","sans-serif";">Phone:
(850) 410-3045</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Arial","sans-serif";">Fax:
(850) 487-4427</span></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span style="font-size: 7.5pt; font-family: "Arial","sans-serif";">This
electronic message may contain protected health record/care information
intended for addressee(s) only. Unauthorized release or disclosure may violate
state and/or federal laws.</span></p>
<p class="MsoNormal"> </p>
</div>
</div></div>
<!-- cg7.c2.mail.re1.yahoo.com compressed/chunked Mon Nov 16 09:09:57 PST 2009 -->
</div><br>
</body></html>