老方法
function DirIsNull(DirName: string): Boolean;
var
sr: TSearchRec;
FileAttrs: Integer;
begin
Result:=True;
FileAttrs := faReadOnly + faHidden + faSysFile + faVolumeID + faDirectory + faArchive;
if FindFirst(DirName+'/*.*', FileAttrs, sr) = 0 then
begin
repeat
if (sr.Name<>'.') and (sr.Name<>'..') then
begin
Result:=False;
Break;
end;
until FindNext(sr) <> 0;
FindClose(sr);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if DirIsNull('C:/test') then
ShowMessage('空') else ShowMessage('非空');
end;