用DELPHI如何实现:删除指定目录(含子目录)下指定文件名的文件?? 10
展开全部
Function Dir_Del_EX(Const aPath: String): Boolean; //uses ShellAPI 删除一个目录:包括非空目录, 或者文件
Var
FO: TSHFILEOPSTRUCT;
aDir: String;
Begin
aDir := ExcludeTrailingPathDelimiter(aPath);
FillChar(FO, SizeOf(FO), 0);
With FO Do
Begin
Wnd := 0;
wFunc := FO_DELETE;
pFrom := PChar(aDir + #0);
pTo := #0#0;
fFlags := FOF_NOCONFIRMATION + FOF_SILENT;
End;
Result := (SHFileOperation(FO) = 0);
End;
Var
FO: TSHFILEOPSTRUCT;
aDir: String;
Begin
aDir := ExcludeTrailingPathDelimiter(aPath);
FillChar(FO, SizeOf(FO), 0);
With FO Do
Begin
Wnd := 0;
wFunc := FO_DELETE;
pFrom := PChar(aDir + #0);
pTo := #0#0;
fFlags := FOF_NOCONFIRMATION + FOF_SILENT;
End;
Result := (SHFileOperation(FO) = 0);
End;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询