0

I dont know why, but when I start to test this, no matter which letter i enter, it drops out print("THIS FILE IS DELETED") and no other options. Something must be wrong with nesting if statement.

import os, shutil, send2trash

def delete_files(folder):
    for folderName, subfolders, filenames in os.walk(folder):
        for filename in filenames:
            full_file_name = os.path.join(folderName, filename)
            size = os.path.getsize(full_file_name)
            if size > 100000000:
                print(filename, size)
                print("Do you want to delete this file?")
                confirm = input("Y or N? ")
                if confirm == "Y" or "y":
                    print("THIS FILE IS DELETED")
                    #send2trash.send2trash(filename)
                elif confirm == "N" or "n":
                    print("Let`s keep this file!")
delete_files(r"M:\Tables_Field\Processing\!-=ieksejie dokumenti=-\!Emīls")

0 Answers0