{$WARN SYMBOL_PLATFORM OFF}
function DeletePath(mDirName: string; Ext: String = '*'): Boolean;
var
vSearchRec: TSearchRec;
vPathName, tmpExt: string;
K: Integer;
begin
Result := true;
tmpExt := Ext;
if Pos('.', tmpExt) = 0 then
tmpExt := '.' + tmpExt;
vPathName := mDirName + '\*.*';
K := FindFirst(vPathName, faAnyFile, vSearchRec);
while K = 0 do
begin
if (vSearchRec.Attr and faDirectory > 0) and
(Pos(vSearchRec.Name, '..') = 0) then
begin
FileSetAttr(mDirName + '\' + vSearchRec.Name, faDirectory);
Result := DeletePath(mDirName + '\' + vSearchRec.Name, Ext);
end
else if Pos(vSearchRec.Name, '..') = 0 then
begin
FileSetAttr(mDirName + '\' + vSearchRec.Name, 0);
if ((CompareText(tmpExt, ExtractFileExt(vSearchRec.Name)) = 0) or (CompareText(tmpExt, '.*') = 0)) then
Result := DeleteFile(PChar(mDirName + '\' + vSearchRec.Name));
end;
if not Result then
Break;
K := FindNext(vSearchRec);
end;
FindClose(vSearchRec);
end;