Excluír directorios de os.walk

Borrar todos los ficheros y subdirectorios de un directorio

# Delete everything reachable from the directory named in 'top',# assuming there are no symbolic links.# CAUTION: This is dangerous! For example, if top == '/', it# could delete all your disk files.importosfor root, dirs, files inos.walk(top, topdown=False):
for name in files:
os.remove(os.path.join(root, name))for name in dirs:
os.rmdir(os.path.join(root, name))