|
| Is the directory empty ? (the simpliest way !) |  
|
|---|
Product: Delphi all versions | Category: Files Operation | Skill Level:
 | Scoring:  | Last Update: 04/10/2001 | Search Keys: delphi delphi3000 article borland vcl code-snippet directory files empty | Times Scored: 6 | Visits: 1620 | Uploader: Antarlac Company: Antarlac Software | Reference: N/A | | | Question/Problem/Abstract:
How to determine if a directory is empty | Answer:
The following function is a simple way to determine if a directory is empty. The trick is to look for other files and directories than the two first found DOS directories '.' and '..'.
function IsDirEmpty (const ADirPath :string) :boolean;
var F :TSearchRec;
begin
result := (FindFirst(ADirPath+'\*.*',faAnyFile,F) = 0) and
(FindNext(F) = 0) and
(FindNext(F) <> 0);
FindClose(F);
end;
|
|
|
| |
Sign up to consume product discounts for Bronze memberships !
|
|
| |
Community Ad of A. B. Talal |
|
| |
|
|
|