I\'m fairly new to Python, but I have gotten this code to work, and in fact, do what it\'s intended to do.
However, I\'m wondering if there is a more efficient way t
Since you are recursing through subdirectories, use os.walk:
import os
def scandirs(path):
for root, dirs, files in os.walk(path):
for currentFile in files:
print "processing file: " + currentFile
exts = ('.png', '.jpg')
if currentFile.lower().endswith(exts):
os.remove(os.path.join(root, currentFile))