I'm trying to delete files that are in the recycle bin by using python, but i can't find a way to do it. Thanks.
-
3What OS? Please do not assume everyone know your environments. Also please read How to askwizzup– wizzup2017-02-07 12:07:22 +00:00Commented Feb 7, 2017 at 12:07
-
@wizzup You are referring to a question asking for file deletion, not emptying a recycle bin.gus27– gus272017-02-07 12:34:29 +00:00Commented Feb 7, 2017 at 12:34
Add a comment
|
2 Answers
For the Windows OS you can use the winshell module and it's empty method.
Emptying the recycle bin is as easy as:
import winshell
winshell.recycle_bin().empty(confirm=False, show_progress=False, sound=False)
See some examples here.
Comments
There's a Windows shell module wrapped by PyWin32 that does this, assuming the question is for Windows.
http://timgolden.me.uk/pywin32-docs/shell__SHEmptyRecycleBin_meth.html