Empty Recycle Bin using Python

engrmahabub
Mahabubur Rahman
Published on Dec, 21 2023 1 min read 1 comments
image

First of all install winshell python package as bellow - 

pip install winshell

 

Now write bellow python script - 

import winshell
try:
    winshell.recycle_bin().empty(confirm=False,show_progress=False,sound=True)
    print('Recycle bin is emptied now')
except:
    print('Recycle bin is already empty')

 

Finally execute above script. For example above file named empty_recyclebin.py so execute it as bellow - 

 

python empty_recyclebin.py

 

 

1 Comments

K.R. NooR Dec 21, 2023 - 07:52 AM