Skip to content

Instantly share code, notes, and snippets.

@paitonic
Created February 1, 2012 19:28
Show Gist options
  • Save paitonic/1718781 to your computer and use it in GitHub Desktop.
Save paitonic/1718781 to your computer and use it in GitHub Desktop.
unzip all .zip files in directory
import os
import subprocess
import sys
path = sys.argv[1]
for fname in os.listdir(path):
(name, ext) = os.path.splitext(fname)
if ext == '.zip':
ret = subprocess.call("mkdir" + " {0}".format(name), shell=True)
ret = subprocess.call("mv" + " {0} {1}".format(fname, name), shell=True)
ret = subprocess.call("unzip" + " {0}/{1} -d {0}".format(name, fname, name), shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment