<?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: Unzip files from directory tree in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/unzip-files-from-directory-tree/m-p/50718#M4011</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i moved it now to Python.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 May 2015 05:04:30 GMT</pubDate>
    <dc:creator>Yaron_YosefCohen</dc:creator>
    <dc:date>2015-05-21T05:04:30Z</dc:date>
    <item>
      <title>Unzip files from directory tree</title>
      <link>https://community.esri.com/t5/python-questions/unzip-files-from-directory-tree/m-p/50714#M4007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Continusally to &lt;A href="https://community.esri.com/thread/121216"&gt;Unzip zip files in folders and subfolders with python&lt;/A&gt; - i didn't get an answer. i&amp;nbsp; work with python 2.7.8 and arcmap 10.3&lt;/P&gt;&lt;P&gt;and i don't why this code does not work with python 2.7.8:&lt;/P&gt;&lt;OL class="dp-py" start="1" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #5c5c5c; margin-bottom: 1px !important; margin-left: 45px !important;"&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; zipfile&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; arcpy,os,os.path,sys&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; arcpy &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; env&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;pattern = &lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;'*.zip'&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;folder = r&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"C:\Project\layers"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;files_process = []&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; root,dirs,files &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; os.walk(r&lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"C:\Project\layers"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; filenames &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; files:&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt; filenames == pattern:&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; files_process.append(os.path.join(root, filenames))&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; zip.extract()&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2015 09:34:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unzip-files-from-directory-tree/m-p/50714#M4007</guid>
      <dc:creator>Yaron_YosefCohen</dc:creator>
      <dc:date>2015-05-19T09:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Unzip files from directory tree</title>
      <link>https://community.esri.com/t5/python-questions/unzip-files-from-directory-tree/m-p/50715#M4008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't have an object named 'zip' that you're calling in the last line.&amp;nbsp; Read the rest of the link/thread that you posted, especially &lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson&lt;/A&gt;​'s reply about researching the module and how to properly use it to extract a zip file.&amp;nbsp; Throw the code he used there into a for loop, and run it against a directory to unzip all archives.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2015 11:34:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unzip-files-from-directory-tree/m-p/50715#M4008</guid>
      <dc:creator>ToddBlanchette</dc:creator>
      <dc:date>2015-05-19T11:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: Unzip files from directory tree</title>
      <link>https://community.esri.com/t5/python-questions/unzip-files-from-directory-tree/m-p/50716#M4009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Suggest moving this to &lt;A href="https://community.esri.com/space/2145"&gt;Python&lt;/A&gt;​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 05:17:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unzip-files-from-directory-tree/m-p/50716#M4009</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2015-05-20T05:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: Unzip files from directory tree</title>
      <link>https://community.esri.com/t5/python-questions/unzip-files-from-directory-tree/m-p/50717#M4010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/2034"&gt;Timothy Hales&lt;/A&gt;​ an example of the limited moderator ability to move "Developer" threads when posted in the general Discussion section Python development won't get selected unless they navigate.&amp;nbsp; Again the suggestion to move/alter Developer from level one&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 07:51:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unzip-files-from-directory-tree/m-p/50717#M4010</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-05-20T07:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Unzip files from directory tree</title>
      <link>https://community.esri.com/t5/python-questions/unzip-files-from-directory-tree/m-p/50718#M4011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i moved it now to Python.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2015 05:04:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unzip-files-from-directory-tree/m-p/50718#M4011</guid>
      <dc:creator>Yaron_YosefCohen</dc:creator>
      <dc:date>2015-05-21T05:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: Unzip files from directory tree</title>
      <link>https://community.esri.com/t5/python-questions/unzip-files-from-directory-tree/m-p/50719#M4012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Finally, this work's for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import zipfile,fnmatch,os&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rootPath = r"C:\Project"&lt;/P&gt;&lt;P&gt;pattern = '*.zip'&lt;/P&gt;&lt;P&gt;for root, dirs, files in os.walk(rootPath):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in fnmatch.filter(files, pattern):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(os.path.join(root, filename))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; zipfile.ZipFile(os.path.join(root, filename)).extractall(os.path.join(root, filename.split(".")[0]))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jun 2015 10:41:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unzip-files-from-directory-tree/m-p/50719#M4012</guid>
      <dc:creator>Yaron_YosefCohen</dc:creator>
      <dc:date>2015-06-02T10:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Unzip files from directory tree</title>
      <link>https://community.esri.com/t5/python-questions/unzip-files-from-directory-tree/m-p/50720#M4013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;for completeness this answer is also in &lt;A href="http://stackoverflow.com/questions/28339000/unzip-zip-files-in-folders-and-subfolders-with-python" title="http://stackoverflow.com/questions/28339000/unzip-zip-files-in-folders-and-subfolders-with-python"&gt;Unzip zip files in folders and subfolders with python - Stack Overflow&lt;/A&gt;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jun 2015 10:42:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unzip-files-from-directory-tree/m-p/50720#M4013</guid>
      <dc:creator>Yaron_YosefCohen</dc:creator>
      <dc:date>2015-06-02T10:42:37Z</dc:date>
    </item>
  </channel>
</rss>

