#!/usr/bin/env python import os,sys from pprint import pprint for root, dirs, files in os.walk("_lab"): for file in files: if file.endswith(".jpg"): os.remove(os.path.join(root, file)) if file.endswith(".jpeg"): os.remove(os.path.join(root, file)) if file.endswith(".Identifier"): os.remove(os.path.join(root, file))