Recycle Bin and Python

Dave Brueck dave at pythonapocrypha.com
Fri Oct 15 08:28:34 EDT 2004


Michael Foord wrote:
> How do I move files into the windoze recycle bin from python ?

This is really a Windows API question first, and a Python question second.

1) Find out the "official" way to do this in Windows

I googled for "msdn move file recycle bin" and the first link that came back was 
a page on MSDN for SHFileOperation. In typical Windows fashion, it involves 
populating some structure and passing it to the function, but it does appear to 
do the trick.

2) Figure out how to do this in Python.

You can create such a structure in ctypes, after which you can make the actual 
call like this:

i = windll.shell32.SHFileOperationA(byref(yourStruct))

HTH,
Dave



More information about the Python-list mailing list