开发者

What does ShFileOperation do when the recycle bin is full?

I use this procedure:

function MoveToRecycle(sFileName: widestring): Boolean;
var
  fos: TSHFileOpStructW;
begin
  FillChar(fos, SizeOf(fos), 0);
  with fos do
  begin
    wnd := 0;
    wFunc  := FO_DELETE;
    pFrom  := PWideChar(sFileName + #0 + #0);
    pTo := #0 + #0;
    fFlags := FOF_FILESONLY or FOF_ALLOWUNDO or FOF_NOCONFIRMATION or FOF_SILENT;
  end;
  Result := (ShFileOperationW(f开发者_运维知识库os) = 0);
end;

What will happen if the recycle bin is full, does it return false or delete file permanently ?

Any help would be appreciated.


The best way to find out is to actually do it. Made my recycle bin be minimum 1 percent of drive. Created a bunch of large files and used your function to move them to recycle bin.

What I am finding out (on XP anyways) is that the function always moves it to the recycle bin; but deletes permanently the oldest deleted file. So it appears when the recycle bin fills up it employs a "first in - first out" type approach to decide which file to boot out.

I was not able to get the function to return false. Perhaps creating a file too large for the allocated recycle bin do this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜