app.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import os import send2trash # walking through the directory for folder, subfolders, files in os.walk('/Users/tithighosh/Documents'): for file in files: # checking if file is # of .txt type if file.endswith('.txt'): path = os.path.join(folder, file) # printing the path of the file # to be deleted print('deleted : ', path ) # deleting the file send2trash.send2trash(path) |