def flush():
    import os, re, os.path
    pattern = "^.*\.pickle$"
    mypath = "."
    for root, dirs, files in os.walk(mypath):
        for file in filter(lambda x: re.match(pattern, x), files):
            print("Remove: %s" % os.path.join(root, file))
            os.remove(os.path.join(root, file))

if __name__ == "__main__":
    flush()
