extern "C" CMDAPIIMPORT void CMDIsDir ( const char * name ) ;
This function returns TRUE if the name specified is that of a valid existing directory. Otherwise it returns FALSE.
This function is used by many external commands to determine how they should treat their arguments. Various commands will append "\*" to the name and act upon the directory's contents if it happens to be the name of an existing directory, and will only treat the name as a wildcard specification if it does not.
Note: This approach to argument processing is for backwards compatibility only, and is not recommended for new external commands. It causes quirks with installable filesystems such as NFS, where the wildcard characters '*' and '?' are legal in file and directory names. Commands should not adopt an argument syntax that assumes anything about file or directory names except that they cannot contain slashes or the NUL character.
A better approach is not to check the name against the filesystem at all, but instead to split it into a pathname prefix part and a basename wildcard part. The basename should be the part that follows the final slash, and the pathname prefix should be the rest of the argument minus the basename. If the basename is the empty string, because the argument ended with a slash, then it is the name of a directory, and "*" should be used as the wildcard. The user can thus always unambiguously specify operation on all files in a directory by appending a slash to the directory name, and always unambiguously operate on the directory itself by not appending a trailing slash.
This latter approach provides consistent behaviour that is solely and predictably (from the user's point of view) determined by the syntax of the argument passed to the command, and does not depend from whether or not an existing file or directory matches the argument at the time that the command happens to be executed.