Checks if a regular file exists and it is not a directory, etc. It follows symlinks.
l = is_regular_file(fname, ignoreErrors)
Where:
fname
: Name of the file 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 regular file and false otherwise.
The following program checks the if a file is a regular file or not:
PROGRAM is_regular_fileExample
USE FU_Files, ONLY: is_regular_file
IMPLICIT NONE
CHARACTER(LEN=:), ALLOCATABLE :: path
path='file1'
IF (is_regular_file(path)) THEN
WRITE(*,*) 'It is a file'
ELSE
WRITE(*,*) 'It is not a file'
END IF
END PROGRAM is_regular_fileExample
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | fname |
Name of the file 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 regular file. False otherwise.