system_dir(3f) - [M_system] return filenames in a directory matching specified wildcard string (LICENSE:PD)
Synopsis
Description
Options
Returns
Example
Author
License
function system_dir(directory,pattern,ignorecase)
character(len=*),intent(in),optional :: directory character(len=*),intent(in),optional :: pattern logical,intent(in),optional :: ignorecase character(len=:),allocatable :: system_dir(:)
returns an array of filenames in the specified directory matching the wildcard string (which defaults to "*").
DIRECTORY name of directory to match filenames in. Defaults to ".". PATTERN wildcard string matching the rules of the matchw(3f) function. Basically
o "*" matches anything o "?" matches any single character IGNORECASE Boolean value indicating whether to ignore case or not when performing matching
system_dir An array right-padded to the length of the longest filename. Note that this means filenames actually containing trailing spaces in their names may be incorrect.
Sample program:
program demo_system_dir use M_system, only : system_dir, system_isdir implicit none character(len=:),allocatable :: dirname write(*, (a))system_dir(pattern=*.f90) dirname=/tmp if(system_isdir(dirname))then write(*, (a))system_dir(pattern=*.f90) else write(*, (a))<WARNING:>//dirname// does not exist endif end program demo_system_dir
John S. Urban
Public Domain
Nemo Release 3.1 | system_dir (3) | July 22, 2023 |