Delphi – Move a file in the recycle bin
uses ShellAPI; function MoveToRecycle(sFileName: string): Boolean; var fos: TSHFileOpStruct; begin FillChar(fos, SizeOf(fos), 0); with fos do begin wFunc := FO_DELETE; pFrom := PChar(sFileName); fFlags := FOF_ALLOWUNDO or FOF_NOCONFIRMATION or FOF_SILENT; end; Result := (0 = ShFileOperation(fos)); end;