recycle bin

Just starting out? Need help? Post your questions and find answers here.
artnat
User
User
Posts: 12
Joined: Sun Nov 10, 2024 3:34 pm

recycle bin

Post by artnat »

Is there a possibility to delete files/directories into the recycle bin in windows?
Axolotl
Enthusiast
Enthusiast
Posts: 798
Joined: Wed Dec 31, 2008 3:36 pm

Re: recycle bin

Post by Axolotl »

you can use the RenameFile() if you know the folder of the Recycle Bin with the help of SHGetSpecialFolderLocation_() and #CSIDL_BITBUCKET.
Or maybe this can help:

Code: Select all

 
#FOF_NOERRORUI = $400 

Procedure RecycleFile(file$)
  m=AllocateMemory(Len(file$)+2)
  If m
    PokeS(m,file$) : SHFileOp.SHFILEOPSTRUCT : SHFileOp\pFrom=m : SHFileOp\wFunc=#FO_DELETE
    SHFileOp\fFlags=#FOF_ALLOWUNDO|#FOF_NOERRORUI : ok=SHFileOperation_(SHFileOp) : FreeMemory(m)
    If ok=0 : ok=1 : Else : ok=0 : EndIf
  EndIf
  ProcedureReturn ok
EndProcedure

RecycleFile("YourFile.txt") ; <== change this to your file. 
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
AZJIO
Addict
Addict
Posts: 2141
Joined: Sun May 14, 2017 1:48 am

Re: recycle bin

Post by AZJIO »

winapi library
You can do a text search in all files, in this case "recycle" and you will always find the answer.
Image
Post Reply