I'm familiar with file systems. The question is why Microsoft exposes a virtual file path that can't be used?LCMark wrote: ↑Thu May 12, 2022 9:25 ammacOS does too - its at ~/.Trash (I think there are also folders related to Trash on each read-write volume as well).Serious question: why does Microsoft provide a path to the Recycle Bin if it can't be used?
The files-which-you-might-want-to-recover have to be stored somewhere!
Linux is chock full o' virtual folders (eg /proc), and they work just like any other. Win's C:\$Recycle.Bin shows in some contexts but not others, and I haven't found a way to use it. All the examples I could find require using a dozen lines of VBScript like SparkOut's example.
I wonder if Microsoft has considered investing in usage data gathering that would allow them to know that putting things in the Recycle Bin is something people do. If we can write a dozen lines of VBScript, I'll bet they can find the technology to make that a one-liner like other OSes do.
FWIW Mac and Linux work great by just using LC's rename command, e.g.:
Code: Select all
on mouseup
-- Make trashable file:
put specialFolderPath("Desktop")&"/_TRASH_THIS_EXAMPLE.txt" into tFile
put "I'm a goner" into url ("file:"& tFile)
--
TrashFile tFile
end mouseup
on TrashFile pFile
switch the platform
case "Linux"
put "~/.local/share/Trash/files" into tTrashPath -- good
break
case "macOS"
put "~/.Trash" into tTrashPath -- good
break
case "Win32"
put "C:/$Recycle.Bin" into tTrashPath -- error 5 (permissions)
break
end switch
--
-- Do the deed:
set the itemdel to "/"
put tTrashPath &"/"& last item of pFile into tTrashFile
rename file pFile to tTrashFile
put the result &&"(" &sysError()&")"
end TrashFile