PhysiologyWeb Logo  Search
Share on Facebook Share on Twitter Share on LinkedIn Share on Pinterest Email Copy URL
PhysiologyWeb Loading...

Is It a Directory/Folder?
It is often useful to determine if an entry in a file directory is a directory/folder or a file. Here is a simple Delphi function that takes a path as its input, determines if the path points to a directory/folder, and returns true or false. This function is very useful for working with directories/folders and files. For additional Delphi code for the Windows operating system, see Useful Delphi Code for the Windows Operating System.
function IsDirectory(FullFileName: String): Boolean;
TheAttributes: Integer;
IsDirectory := False;

TheAttributes := 0;

If FullFileName <> '' then
TheAttributes := FileGetAttr(FullFileName);
If ((TheAttributes and faDirectory) = faDirectory) then IsDirectory := True;

Posted: Saturday, May 13, 2023
Last updated: Saturday, May 20, 2023