алгоритм...
function IsDirEmpty(sDirPath: String): Boolean;
var
fs: TSearchRec;
begin
Result := True;
sDirPath:= IncludeTrailingPathDelimiter(sDirPath);
if FindFirst(sDirPath+ '*.*', faAnyFile, fs) = 0 then
repeat
if (fs.Name <> '.') and (fs.Name <> '..') then
begin
Result := False;
FindClose(fs);
Exit;
end;
until FindNext(fs) <> 0;
FindClose(fs);
end;
....
if isDirEmpty(Path) then
RmDir(Path);
|