Uses Shellapi;
var
FileOp: TSHFileOpStruct;
begin
with FileOp do
begin
Wnd := Handle; //hinstance;
wFunc := FO_DELETE; //FO_COPY,FO_RENAME,FO_MOVE,FO_DELETE
pFrom := Pchar(‘D:\BAK18-03-30 09-55-31‘ + #0);
pTo := nil; //目标文件及路径
fFlags := FOF_NOCONFIRMATION + FOF_NOERRORUI + FOF_SILENT;
//标志表明允许恢复,无须确认并不显示出错信息
hNameMappings := nil;
// lpszProgressTitle:=‘正在删除废旧文件夹‘;
fAnyOperationsAborted := false; //操作选择位
end;
SHFileOperation(FileOp); //执行删除操作