Checks if a directory exists.
l = is_directory(fname, ignoreErrors)
Where:
fname
: Name of the direcory to be checked.ignoreErrors
: False to print a detailed description of the error message.
Optional parameter. Default is False.It returns True if fname is a directory and false otherwise.
The following program checks the existance of a folder:
PROGRAM is_directoryExample
USE FU_Files, ONLY: is_directory
IMPLICIT NONE
CHARACTER(LEN=:), ALLOCATABLE :: path
path='/tmp'
IF (is_directory(path)) THEN
WRITE(*,*) 'It is a directory'
ELSE
WRITE(*,*) 'It is not a directory'
END IF
END PROGRAM is_directoryExample
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | fname |
Name of the directory to be checked. |
||
logical, | intent(in), | optional | :: | ignoreErrors |
False to print a detailed description of the error message. Optional parameter. Default is False. |
True if fname is a directory. False otherwise.