Recycle Bin and Python

D

Dave Brueck

Michael said:
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
 
M

Michael Foord

Dave Brueck said:
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


It does help.. yeeurgh....

But thanks.

Fuzzy

http://www.voidspace.org.uk/atlantibots/pythonutils.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,157
Latest member
MercedesE4
Top