Function to scan a set of directories for a given file

Location in HEALPix directory tree: src/f90/mod/paramfile_io.F90 


var=scan_directories( directories, filename, fullpath )


name&dimensionality kind in/out description
directories CHR IN contains the set of directories (up to 20), separated by an ASCII character of value < 32 (see concatnl). During the search, it is assumed that the given directories and filename can be separated by nothing, a / (slash) or a $\backslash$ (backslash)
filename CHR IN the file to be found.
fullpath CHR OUT returns the full path to the first occurrence of the file among the directories provided. Empty if the file is not found. The search is not recursive.
var LGT OUT set to true if the file is found, to false otherwise.


use paramfile_io
character(len=filenamelen) :: dirs, full
logical(lgt) :: found
dirs = concatnl('dir1','/dir2','/dir2/subdir1/') ! build directories list.
found = scan_directories(dirs, 'myfile', full) ! do the search
if (found) print*,trim(full)
Search for 'myfile' in the directories 'dir1', '/dir2', '/dir2/subdir1/'


This section lists the routines related to scan_directories

parse an ASCII file for parameters definition
concatenates a set of substrings into one string, interspaced with LineFeed character

Version 3.31, 2017-01-06