send2trash icon indicating copy to clipboard operation
send2trash copied to clipboard

Files on Recycle Bin-enabled network drives not sent to Recycle Bin

Open blackwind opened this issue 11 years ago • 3 comments

Using a registry tweak, one can enable the Windows Recycle Bin on network drives:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{DEADBEEF-0000-0000-0000-000000000001}]
"RelativePath"="N:\\"
"Category"=dword:00000004
"Name"=""

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder\{DEADBEEF-0000-0000-0000-000000000001}]
"NukeOnDelete"=dword:00000000

Alas, send2trash isn't prepared for this use case and permanently deletes the given file if it resides on a network drive. Can we get a fix?

blackwind avatar Dec 30 '14 02:12 blackwind

I'm unfamiliar with Windows, let alone its hacks, but I'd be happy to consider a patch if it doesn't introduce dangerous behavior.

This hack, do you have the reference of an article about it? I'm surprised that it doesn't work with send2trash: all it does is call the native win32 api to send its file to trash.

ghost avatar Dec 30 '14 03:12 ghost

Reference: https://social.technet.microsoft.com/forums/windows/en-US/a349801f-398f-4139-8e8b-b0a92f599e2b/enable-recycle-bin-on-mapped-network-drives

Because this trick works only on Vista or higher, I suspect the solution is to switch to the IFileOperation interface. The current SHFileOperation code should be preserved for pre-Vista clients where IFileOperation is unavailable.

blackwind avatar Dec 30 '14 07:12 blackwind

IFileOperation support may have resolved this issue, although I don't have a setup to verify at this point.

arsenetar avatar Jan 22 '21 02:01 arsenetar