Continusally to Unzip zip files in folders and subfolders with python - i didn't get an answer. i work with python 2.7.8 and arcmap 10.3
and i don't why this code does not work with python 2.7.8:
Solved! Go to Solution.
Finally, this work's for me.
import zipfile,fnmatch,os
rootPath = r"C:\Project"
pattern = '*.zip'
for root, dirs, files in os.walk(rootPath):
for filename in fnmatch.filter(files, pattern):
print(os.path.join(root, filename))
zipfile.ZipFile(os.path.join(root, filename)).extractall(os.path.join(root, filename.split(".")[0]))
You don't have an object named 'zip' that you're calling in the last line. Read the rest of the link/thread that you posted, especially Dan Patterson's reply about researching the module and how to properly use it to extract a zip file. Throw the code he used there into a for loop, and run it against a directory to unzip all archives.
Suggest moving this to Python
Timothy Hales 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. Again the suggestion to move/alter Developer from level one
i moved it now to Python.
Finally, this work's for me.
import zipfile,fnmatch,os
rootPath = r"C:\Project"
pattern = '*.zip'
for root, dirs, files in os.walk(rootPath):
for filename in fnmatch.filter(files, pattern):
print(os.path.join(root, filename))
zipfile.ZipFile(os.path.join(root, filename)).extractall(os.path.join(root, filename.split(".")[0]))
for completeness this answer is also in Unzip zip files in folders and subfolders with python - Stack Overflow