Euphoria
Ticket #235:
delete_file() Enhancement for Windows Recycle Bin
-
Reported by
euphoric
Oct 21, 2010
It would be nice to have an option for delete_file() to send the file to the Windows Recycle Bin instead of completing deleting it.
delete_file( sequence filename, integer to_recycle_bin = 1 )
- nixes would ignore the to_recycle_bin flag, but on Windows, the file would get moved to the Recycle Bin by default. This is expected behavior on Windows.
Details
1. Comment by ArthurCrump
Oct 21, 2010
The API required is SHFileOperation.
I tried this out some time ago and successfully sent a file to the recycle bin and then recovered it. However, not everything I tried was successful, so I abandoned the idea and no longer have code ready to hand and would be hesitant to offer it in any case because of problems in some cases.
Perhaps someone else can but a decent wrapper round SHFileOperation?
Arthur
2. Comment by jeremy
Oct 27, 2010
Arthur, can you post the code here in an eucode tag?
3. Comment by ArthurCrump
Oct 31, 2010
I have tried to put the coding in this thread, but I keep being told that something is too big. Instead I will submit the code via the rapideuphoria programming page. Not tonight, though, it's too late in the evening here in England. In any case, it could do with a bit more explanation.
4. Comment by ArthurCrump
Nov 01, 2010
As requested by Jeremy, I have offered the coding for moving files to the recycle bin. However, I could not get it to this thread in an <eucode> tag, so I have submitted it to the main archive as SHFileOp.zip. It is available for the Euphoria team to use in any way they like.
5. Comment by ArthurCrump
Nov 04, 2010
While looking for something else, I came across a previous wrapper for SHFileOperation, written by Greg Haberek. This may be found in the archive by searching for SHFileOperation_Wrapper. However, it does require win32lib.
Arthur