<?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: os.walk(arcpy.env.workspace) retur only files from the root folder in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/os-walk-arcpy-env-workspace-retur-only-files-from/m-p/261670#M20118</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Some good, workable solutions here:&amp;nbsp; &lt;A class="link-titled" href="https://stackoverflow.com/questions/229186/os-walk-without-digging-into-directories-below" title="https://stackoverflow.com/questions/229186/os-walk-without-digging-into-directories-below"&gt;python - os.walk without digging into directories below - Stack Overflow&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Jun 2018 14:47:46 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2018-06-07T14:47:46Z</dc:date>
    <item>
      <title>os.walk(arcpy.env.workspace) retur only files from the root folder</title>
      <link>https://community.esri.com/t5/python-questions/os-walk-arcpy-env-workspace-retur-only-files-from/m-p/261669#M20117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I read only files from the root folder?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: small; font-family: Consolas;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; (path, dirs, files) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: small; font-family: Consolas;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6f008a; font-size: small; font-family: Consolas;"&gt;os&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt;.walk(&lt;/SPAN&gt;&lt;SPAN style="color: #6f008a; font-size: small; font-family: Consolas;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt;.env.workspace):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: small; font-family: Consolas;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; file &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: small; font-family: Consolas;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; files:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: small; font-family: Consolas;"&gt;print&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; file &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jun 2018 13:57:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/os-walk-arcpy-env-workspace-retur-only-files-from/m-p/261669#M20117</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2018-06-07T13:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: os.walk(arcpy.env.workspace) retur only files from the root folder</title>
      <link>https://community.esri.com/t5/python-questions/os-walk-arcpy-env-workspace-retur-only-files-from/m-p/261670#M20118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Some good, workable solutions here:&amp;nbsp; &lt;A class="link-titled" href="https://stackoverflow.com/questions/229186/os-walk-without-digging-into-directories-below" title="https://stackoverflow.com/questions/229186/os-walk-without-digging-into-directories-below"&gt;python - os.walk without digging into directories below - Stack Overflow&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jun 2018 14:47:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/os-walk-arcpy-env-workspace-retur-only-files-from/m-p/261670#M20118</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-06-07T14:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: os.walk(arcpy.env.workspace) retur only files from the root folder</title>
      <link>https://community.esri.com/t5/python-questions/os-walk-arcpy-env-workspace-retur-only-files-from/m-p/261671#M20119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;just add a break&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; (path, dirs, files) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6f008a; font-family: Consolas; font-size: small;"&gt;os&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;.walk(&lt;/SPAN&gt;&lt;SPAN style="color: #6f008a; font-family: Consolas; font-size: small;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;.env.workspace):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; file &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; files:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;print&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; file &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;......&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;#&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: small; font-family: Consolas;"&gt;# os.walk read only the root folder&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: small; font-family: Consolas;"&gt;#&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: small; font-family: Consolas;"&gt;break&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jun 2018 15:44:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/os-walk-arcpy-env-workspace-retur-only-files-from/m-p/261671#M20119</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2018-06-07T15:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: os.walk(arcpy.env.workspace) retur only files from the root folder</title>
      <link>https://community.esri.com/t5/python-questions/os-walk-arcpy-env-workspace-retur-only-files-from/m-p/261672#M20120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd use os.listdir:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; myFiles &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listdir&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"C:\Users\jona6782\Documents\ArcGIS"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;myFiles&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'49058003.jpg'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'AddIns'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'c5A5E1C002DC8445A8FC05C471B1.json'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Default.gdb'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'GeoNet'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'happy.png'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'JQNew - Copy.sd'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'JQNew.sd'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'LotsOfData.mxd'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'MyProject8.ppkx'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'MyService123.sd'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'New Folder'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'OnlineProjects'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Packages'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Portland.slpk'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Projects'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'ProjectTemplates'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'ProPortalData'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Rotterdam.slpk'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'scratch'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'scratch.gdb'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Shapefiles'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'TilingSchemes'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Toolbox.tbx'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'worldcities.gdb'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'WorldCities.mxd'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'WorldCitiesPG.mxd'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will return a list of the files/folders in a specific directory.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:50:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/os-walk-arcpy-env-workspace-retur-only-files-from/m-p/261672#M20120</guid>
      <dc:creator>JonathanQuinn</dc:creator>
      <dc:date>2021-12-11T12:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: os.walk(arcpy.env.workspace) retur only files from the root folder</title>
      <link>https://community.esri.com/t5/python-questions/os-walk-arcpy-env-workspace-retur-only-files-from/m-p/261673#M20121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But with os.walk you know you are only getting files, with os.listdir you need to do additional steps to determine the type of file system object.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jun 2018 19:34:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/os-walk-arcpy-env-workspace-retur-only-files-from/m-p/261673#M20121</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-06-07T19:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: os.walk(arcpy.env.workspace) retur only files from the root folder</title>
      <link>https://community.esri.com/t5/python-questions/os-walk-arcpy-env-workspace-retur-only-files-from/m-p/261674#M20122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oops, missed the "only files" part. os.path.isfile can be used as well, then:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://stackoverflow.com/questions/11968976/list-files-in-only-the-current-directory" title="https://stackoverflow.com/questions/11968976/list-files-in-only-the-current-directory"&gt;python - List files in ONLY the current directory - Stack Overflow&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As always, lots of ways to do the same thing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jun 2018 20:31:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/os-walk-arcpy-env-workspace-retur-only-files-from/m-p/261674#M20122</guid>
      <dc:creator>JonathanQuinn</dc:creator>
      <dc:date>2018-06-07T20:31:45Z</dc:date>
    </item>
  </channel>
</rss>

