Determines the filename without the path and without the final extension given a path.
l = stem(fname)
Where:
fname
: Name or path of the file the determine the filename without the final extension and the path.It returns the filename of the file without the extension and without path.
The following program gets the filenames of some files
PROGRAM stemExample
USE FU_Files, ONLY: stem
IMPLICIT NONE
CHARACTER(LEN=:), ALLOCATABLE :: path
path='file1.txt'
WRITE(*,*) path, ' ', stem(path)
path='./file1.txt'
WRITE(*,*) path, ' ', stem(path)
path='/tmp/file1.txt'
WRITE(*,*) path, ' ', stem(path)
path='/tmp/file1'
WRITE(*,*) path, ' ', stem(path)
END PROGRAM stemExample
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | fname |
Filename or path to a file. |
Filename without the final extension and without the path. If filename consists of an extension only, the extension is returned.