mkdir Function

public function mkdir(dir, ignoreErrors) result(res)

Creates a directory.

Syntax

 l = mkdir(dir, ignoreErrors)

Where:

  • dir: Path and name of the directory to be created.
  • ignoreErrors: False to print a detailed description of the error message. Optional parameter. Default is False.

It returns True if the process has been succesful or False in case of error.

Example

The following program creates folder tmp:

 PROGRAM mkdirExample
    USE FU_Files, ONLY: mkdir
    IMPLICIT NONE
    CHARACTER(LEN=:), ALLOCATABLE :: path
    path='tmp'
    IF (mkdir(path)) THEN
       WRITE(*,*) 'Success'
    ELSE
       WRITE(*,*) 'Error'
    END IF
 END PROGRAM mkdirExample

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: dir

Path and name of the directory to be created.

logical, intent(in), optional :: ignoreErrors

False to print a detailed description of the error message. Optional parameter. Default is False.

Return Value logical

True if the process has been succesful. False in case of error.


Contents