#!/usr/bin/python

import os, sys, hashlib, shutil

def unzip(src):
    cnt = 0
    
    for dirpath, dirnames, filenames in os.walk(src):
        #print dirpath, dirnames, filenames
  	
    	if src in dirnames:
    	    print "Skipping target directory."
    	    continue
        try:
	    for i in range(0, len(filenames)):
		    fileName = filenames[i]
		    l = len(fileName)
		    ext = fileName[l-4:l] 
		    if ext == '.zip':
			print fileName
			call(["./unzipScript.sh", os.path.join(dirpath, fileName)])
		    else:
			continue

	except Exception as e:
	    print "searchAndCollect(): Error reading %s" % (str(e))


if __name__ == '__main__':
    unzip('/home/animesh/Downloads/Malware/')
    print "End"
