Removes a file or directory.
l = rm(fname, ignoreErrors)
Where:
fname
: Name of the file or folder to remove.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.
The following program removes file1:
PROGRAM rmExample
USE FU_Files, ONLY: rm
IMPLICIT NONE
CHARACTER(LEN=:), ALLOCATABLE :: path
path='file1'
IF (rm(path)) THEN
WRITE(*,*) 'Success'
ELSE
WRITE(*,*) 'Error'
END IF
END PROGRAM rmExample
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | fname |
Name of the file or directory to be removed. |
||
logical, | intent(in), | optional | :: | ignoreErrors |
False to print a detailed description of the error message. Optional parameter. Default is False. |
True if the process has been succesful. False in case of error.