find . -name "*.bak" -type f -delete
import os for file in os.scandir(path): if file.name.endswith(".bak"): os.unlink(file.path)