<?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: plist appended to folder from listworkspaces in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/plist-appended-to-folder-from-listworkspaces/m-p/475160#M37217</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;While I appreciate esri trying to work in as much functionality as they can to arcpy so its a "one stop shop" of sorts, I feel like you should just use existing standard modules in python for this task. os.walk goes down a directory tree and for each directory yields a tuple of (dirpath, dirnames, filenames) If you do whats below it will print each directory name then move on to the next directory. The arcpy tool is going to give you results for things like database connection files and geodatabases but you can add logic to the loop to recognize that anything with the .sde or .gdb extensions are workspaces and not just files and folders.&lt;TT class="docutils literal"&gt;&lt;SPAN class="pre"&gt;&lt;/SPAN&gt;&lt;SPAN class="pre"&gt;&lt;/SPAN&gt;&lt;SPAN class="pre"&gt;&lt;/SPAN&gt;&lt;/TT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for (dirpath, dirnames, filenames) is os.walk(top_dir):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if len(dirnames):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print (dirnames)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Sep 2014 19:48:59 GMT</pubDate>
    <dc:creator>ChrisMathers</dc:creator>
    <dc:date>2014-09-10T19:48:59Z</dc:date>
    <item>
      <title>plist appended to folder from listworkspaces</title>
      <link>https://community.esri.com/t5/python-questions/plist-appended-to-folder-from-listworkspaces/m-p/475159#M37216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've got a tool I'm working on that recursively iterates through workspaces using arcpy. For each workspace it looks for rasters and notes details about them before looking through any workspaces under the current workspace. For the test data I'm using there is also installer for the Mac and Windows version of Adobe Acrobat amongst it. When my tool gets up to: acrobat\mac\Adobe Reader 6.0\Adobe Reader 6.0.app\Contents\Plug-ins\Multimedia.acroplugin\Contents\MacOS\MPP\QuickTime.mpp\Contents I use ListWorkspaces and I expect to get the subfolders MacOS and Resources. But instead it tells me the workspaces are named plistMacOS and plistResources. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ie. (Have changed workspace path slightly)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; arcpy.env.workspace = r"k:\acrobat\mac\Adobe Reader 6.0\Adobe Reader 6.0.app\Contents\Plug-ins\Multimedia.acroplugin\Contents\MacOS\MPP\QuickTime.mpp\Contents"&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; allWorkspaces = arcpy.ListWorkspaces("*", "All")&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; for currentWorkspace in allWorkspaces:&lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print currentWorkspace&lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;plistMacOS&lt;/P&gt;&lt;P&gt;plistResources&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; In the folder I'm checking there is a file called Info-macos.plist which I assume has something to do with it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; The problem is these workspace names aren't valid so when I try to search them I get an error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Any ideas what is causing this and how to work around this? I could check the workspace exists but I feel I shouldn't have to.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Sep 2014 01:28:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/plist-appended-to-folder-from-listworkspaces/m-p/475159#M37216</guid>
      <dc:creator>AllanMills</dc:creator>
      <dc:date>2014-09-01T01:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: plist appended to folder from listworkspaces</title>
      <link>https://community.esri.com/t5/python-questions/plist-appended-to-folder-from-listworkspaces/m-p/475160#M37217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;While I appreciate esri trying to work in as much functionality as they can to arcpy so its a "one stop shop" of sorts, I feel like you should just use existing standard modules in python for this task. os.walk goes down a directory tree and for each directory yields a tuple of (dirpath, dirnames, filenames) If you do whats below it will print each directory name then move on to the next directory. The arcpy tool is going to give you results for things like database connection files and geodatabases but you can add logic to the loop to recognize that anything with the .sde or .gdb extensions are workspaces and not just files and folders.&lt;TT class="docutils literal"&gt;&lt;SPAN class="pre"&gt;&lt;/SPAN&gt;&lt;SPAN class="pre"&gt;&lt;/SPAN&gt;&lt;SPAN class="pre"&gt;&lt;/SPAN&gt;&lt;/TT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for (dirpath, dirnames, filenames) is os.walk(top_dir):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if len(dirnames):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print (dirnames)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2014 19:48:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/plist-appended-to-folder-from-listworkspaces/m-p/475160#M37217</guid>
      <dc:creator>ChrisMathers</dc:creator>
      <dc:date>2014-09-10T19:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: plist appended to folder from listworkspaces</title>
      <link>https://community.esri.com/t5/python-questions/plist-appended-to-folder-from-listworkspaces/m-p/475161#M37218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if your specifically trying to look at rasters within a workspace you should consider using arcpy.da.Walk which was added at 10.1 sp1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this behaves much like the os.walk in python but allows for datatype filters. The tool will recurse through sub directories. Take a look at the link below for examples&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/#/Walk/018w00000023000000/"&gt;http://resources.arcgis.com/en/help/main/10.2/#/Walk/018w00000023000000/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dave&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2014 20:39:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/plist-appended-to-folder-from-listworkspaces/m-p/475161#M37218</guid>
      <dc:creator>DaveBarrett</dc:creator>
      <dc:date>2014-09-10T20:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: plist appended to folder from listworkspaces</title>
      <link>https://community.esri.com/t5/python-questions/plist-appended-to-folder-from-listworkspaces/m-p/475162#M37219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thanks. I had switched to os.walk eventually as I found even stranger problems later on, like when I put an existing directory in a subdirectory to see if it had problems with path name length. It started complaining about workspaces it found not being there which was correct since they really weren't there. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2014 22:22:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/plist-appended-to-folder-from-listworkspaces/m-p/475162#M37219</guid>
      <dc:creator>AllanMills</dc:creator>
      <dc:date>2014-09-10T22:22:53Z</dc:date>
    </item>
  </channel>
</rss>

