Hapus file di folder dengan ekstensi

import os 

for file in os.scandir(path):
    if file.name.endswith(".bak"):
        os.unlink(file.path)
Beautiful Bird