There is no standard intrinsic or statement to determine if a pathname is a directory.
The answer varies depending on how portable the solution has to be.
o is it only needed in Microsoft environments?
o is it only needed in POSIX environments?
o is there always a shell of the same brand available, like POSIX shells (sh,bash,ksh,…)?
o is it only needed for a particular compiler?
o some compilers have an extension intrinsic, typically called ISDIR().
o in a POSIX environment it is easy to use a little C wrapper to isolate you from
whether C is implementing some functionality as a macro or not that you can then
call.
o there are often commands you can call with EXECUTE_COMMAND_LINE like
the Bourne shell “test” command, where the exit status of the command
can be used to determine many properties.
In addition to what has been mentioned, note
In a POSIX environment the github repositories (available via fpm(1)) have
several alternatives, such as system_isdir() and is_dir(). Both repositories
and code have extensive help text.
[dependencies]
M_path = { git = "https://github.com/urbanjost/M_path.git" }
M_system = { git = "https://github.com/urbanjost/M_system.git" }
The fpm command has both an example of using system commands (is_dir) and using a C interface
(c_is_dir).
Depending on the compiler(s) you are using, see if the ISDIR() extension is present.