ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_sysPath::glob Interface Reference

Generate and return the result of globing the specified input pattern.
More...

Detailed Description

Generate and return the result of globing the specified input pattern.

This generic interface is a convenience wrapper around the generic interface isFailedGlob.
See the documentation of isFailedGlob for more details on globing and the methodology.
Unlike isFailedGlob which can gracefully handle the occurrence of runtime error, this generic interface halts the program by calling error stop if a runtime error occurs.

Parameters
[in]pattern: The input scalar character of default kind SK of arbitrary length type parameter containing the directory or file pattern to glob.
Returns
list : The output allocatable vector of containers of type css_type containing scalar strings of kind SK, each element of which contains the path to one entry in the globing.


Possible calling interfaces

use pm_sysPath, only: glob, css_type
type(css_type), allocatable :: list(:)
list = glob(pattern) ! `list` is a vector of string containers.
!
Generate and return the result of globing the specified input pattern.
Definition: pm_sysPath.F90:954
This module contains classes and procedures for manipulating system file/folder paths.
Definition: pm_sysPath.F90:274
Remarks
The procedures under discussion are impure.
Note
The procedures of this generic interface can handle characters of any kind (including nongraphical ASCII characters like newline) on Unix systems.
See also
ls
glob
isFailedGlob
isFailedList


Example usage

1program example
2
3 use pm_kind, only: LK, IK, SK
4 use pm_io, only: display_type
5 use pm_sysPath, only: glob, isFailedMakeDir, css_type
6
7 implicit none
8
9 type(display_type) :: disp
10 type(css_type), allocatable :: css(:)
11 disp = display_type(file = "main.out.F90")
12
13 call disp%skip()
14 call disp%show("glob(SK_'.')")
15 call disp%show( glob(SK_'.') , deliml = SK_"""" )
16 call disp%skip()
17
18 call disp%skip()
19 call disp%show("css = glob(SK_'../get*')")
20 css = glob(SK_'../get*')
21 call disp%show("reshape(css, [size(css), 1])")
22 call disp%show( reshape(css, [size(css), 1]) , deliml = SK_"""" )
23 call disp%skip()
24
25 call disp%skip()
26 call disp%show("css = glob(SK_'../get*/*')")
27 css = glob(SK_'../get*/*')
28 call disp%show("reshape(css, [size(css), 1])")
29 call disp%show( reshape(css, [size(css), 1]) , deliml = SK_"""" )
30 call disp%skip()
31
32 call disp%skip()
33 call disp%show("css = glob(SK_'./*.F90')")
34 css = glob(SK_'./*.F90')
35 call disp%show("reshape(css, [size(css), 1])")
36 call disp%show( reshape(css, [size(css), 1]) , deliml = SK_"""" )
37 call disp%skip()
38
39 call disp%skip()
40 call disp%show("glob(SK_'./*.nonexistent')")
41 call disp%show( glob(SK_'./*.nonexistent') , deliml = SK_"""" )
42 call disp%skip()
43
44end program example
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
Generate and return .true. if the attempt to create the requested directory path fails,...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
2glob(SK_'.')
3"."
4
5
6css = glob(SK_'../get*')
7reshape(css, [size(css), 1])
8"../getBaseName"
9"../getDirCurrent"
10"../getDirHome"
11"../getDirName"
12"../getDirSep"
13"../getDirSeps"
14"../getExtName"
15"../getFileName"
16"../getIndexBaseName"
17"../getIndexDirName"
18"../getIndexExtName"
19"../getPathAbs"
20"../getPathExpandedUser"
21"../getPathHostNameIndex"
22"../getPathJoined"
23"../getPathMatch"
24"../getPathNew"
25"../getPathPosix"
26"../getPathPosixEscaped"
27"../getPathQuoted"
28"../getPathSep"
29"../getPathTemp"
30"../getPathVerbatim"
31"../getPathVerbatimCMD"
32"../getPathVerbatimFish"
33"../getPathVerbatimPosix"
34"../getPathVerbatimPowerShell"
35"../getPathWindows"
36
37
38css = glob(SK_'../get*/*')
39reshape(css, [size(css), 1])
40"../getBaseName/CMakeCache.txt"
41"../getBaseName/CMakeFiles"
42"../getBaseName/CMakeLists.txt"
43"../getBaseName/Makefile"
44"../getBaseName/build.sh"
45"../getBaseName/cmake_install.cmake"
46"../getBaseName/main.F90"
47"../getBaseName/main.exe"
48"../getBaseName/main.out.F90"
49"../getDirCurrent/CMakeCache.txt"
50"../getDirCurrent/CMakeFiles"
51"../getDirCurrent/CMakeLists.txt"
52"../getDirCurrent/Makefile"
53"../getDirCurrent/build.sh"
54"../getDirCurrent/cmake_install.cmake"
55"../getDirCurrent/main.F90"
56"../getDirCurrent/main.exe"
57"../getDirCurrent/main.out.F90"
58"../getDirHome/CMakeCache.txt"
59"../getDirHome/CMakeFiles"
60"../getDirHome/CMakeLists.txt"
61"../getDirHome/Makefile"
62"../getDirHome/build.sh"
63"../getDirHome/cmake_install.cmake"
64"../getDirHome/main.F90"
65"../getDirHome/main.exe"
66"../getDirHome/main.out.F90"
67"../getDirName/CMakeCache.txt"
68"../getDirName/CMakeFiles"
69"../getDirName/CMakeLists.txt"
70"../getDirName/Makefile"
71"../getDirName/build.sh"
72"../getDirName/cmake_install.cmake"
73"../getDirName/main.F90"
74"../getDirName/main.exe"
75"../getDirName/main.out.F90"
76"../getDirSep/CMakeCache.txt"
77"../getDirSep/CMakeFiles"
78"../getDirSep/CMakeLists.txt"
79"../getDirSep/Makefile"
80"../getDirSep/build.sh"
81"../getDirSep/cmake_install.cmake"
82"../getDirSep/main.F90"
83"../getDirSep/main.exe"
84"../getDirSep/main.out.F90"
85"../getDirSeps/CMakeCache.txt"
86"../getDirSeps/CMakeFiles"
87"../getDirSeps/CMakeLists.txt"
88"../getDirSeps/Makefile"
89"../getDirSeps/build.sh"
90"../getDirSeps/cmake_install.cmake"
91"../getDirSeps/main.F90"
92"../getDirSeps/main.exe"
93"../getDirSeps/main.out.F90"
94"../getExtName/CMakeCache.txt"
95"../getExtName/CMakeFiles"
96"../getExtName/CMakeLists.txt"
97"../getExtName/Makefile"
98"../getExtName/build.sh"
99"../getExtName/cmake_install.cmake"
100"../getExtName/main.F90"
101"../getExtName/main.exe"
102"../getExtName/main.out.F90"
103"../getFileName/CMakeCache.txt"
104"../getFileName/CMakeFiles"
105"../getFileName/CMakeLists.txt"
106"../getFileName/Makefile"
107"../getFileName/build.sh"
108"../getFileName/cmake_install.cmake"
109"../getFileName/main.F90"
110"../getFileName/main.exe"
111"../getFileName/main.out.F90"
112"../getIndexBaseName/CMakeCache.txt"
113"../getIndexBaseName/CMakeFiles"
114"../getIndexBaseName/CMakeLists.txt"
115"../getIndexBaseName/Makefile"
116"../getIndexBaseName/build.sh"
117"../getIndexBaseName/cmake_install.cmake"
118"../getIndexBaseName/main.F90"
119"../getIndexBaseName/main.exe"
120"../getIndexBaseName/main.out.F90"
121"../getIndexDirName/CMakeCache.txt"
122"../getIndexDirName/CMakeFiles"
123"../getIndexDirName/CMakeLists.txt"
124"../getIndexDirName/Makefile"
125"../getIndexDirName/build.sh"
126"../getIndexDirName/cmake_install.cmake"
127"../getIndexDirName/main.F90"
128"../getIndexDirName/main.exe"
129"../getIndexDirName/main.out.F90"
130"../getIndexExtName/CMakeCache.txt"
131"../getIndexExtName/CMakeFiles"
132"../getIndexExtName/CMakeLists.txt"
133"../getIndexExtName/Makefile"
134"../getIndexExtName/build.sh"
135"../getIndexExtName/cmake_install.cmake"
136"../getIndexExtName/main.F90"
137"../getIndexExtName/main.exe"
138"../getIndexExtName/main.out.F90"
139"../getPathAbs/CMakeCache.txt"
140"../getPathAbs/CMakeFiles"
141"../getPathAbs/CMakeLists.txt"
142"../getPathAbs/Makefile"
143"../getPathAbs/build.sh"
144"../getPathAbs/cmake_install.cmake"
145"../getPathAbs/main.F90"
146"../getPathAbs/main.exe"
147"../getPathAbs/main.out.F90"
148"../getPathExpandedUser/CMakeCache.txt"
149"../getPathExpandedUser/CMakeFiles"
150"../getPathExpandedUser/CMakeLists.txt"
151"../getPathExpandedUser/Makefile"
152"../getPathExpandedUser/build.sh"
153"../getPathExpandedUser/cmake_install.cmake"
154"../getPathExpandedUser/main.F90"
155"../getPathExpandedUser/main.exe"
156"../getPathExpandedUser/main.out.F90"
157"../getPathHostNameIndex/CMakeCache.txt"
158"../getPathHostNameIndex/CMakeFiles"
159"../getPathHostNameIndex/CMakeLists.txt"
160"../getPathHostNameIndex/Makefile"
161"../getPathHostNameIndex/build.sh"
162"../getPathHostNameIndex/cmake_install.cmake"
163"../getPathHostNameIndex/main.F90"
164"../getPathHostNameIndex/main.exe"
165"../getPathHostNameIndex/main.out.F90"
166"../getPathJoined/CMakeCache.txt"
167"../getPathJoined/CMakeFiles"
168"../getPathJoined/CMakeLists.txt"
169"../getPathJoined/Makefile"
170"../getPathJoined/build.sh"
171"../getPathJoined/cmake_install.cmake"
172"../getPathJoined/main.F90"
173"../getPathJoined/main.exe"
174"../getPathJoined/main.out.F90"
175"../getPathMatch/CMakeCache.txt"
176"../getPathMatch/CMakeFiles"
177"../getPathMatch/CMakeLists.txt"
178"../getPathMatch/Makefile"
179"../getPathMatch/build.sh"
180"../getPathMatch/cmake_install.cmake"
181"../getPathMatch/main.F90"
182"../getPathMatch/main.exe"
183"../getPathMatch/main.out.F90"
184"../getPathNew/CMakeCache.txt"
185"../getPathNew/CMakeFiles"
186"../getPathNew/CMakeLists.txt"
187"../getPathNew/Makefile"
188"../getPathNew/build.sh"
189"../getPathNew/cmake_install.cmake"
190"../getPathNew/main.F90"
191"../getPathNew/main.exe"
192"../getPathNew/main.out.F90"
193"../getPathPosix/CMakeCache.txt"
194"../getPathPosix/CMakeFiles"
195"../getPathPosix/CMakeLists.txt"
196"../getPathPosix/Makefile"
197"../getPathPosix/build.sh"
198"../getPathPosix/cmake_install.cmake"
199"../getPathPosix/main.F90"
200"../getPathPosix/main.exe"
201"../getPathPosix/main.out.F90"
202"../getPathPosixEscaped/CMakeCache.txt"
203"../getPathPosixEscaped/CMakeFiles"
204"../getPathPosixEscaped/CMakeLists.txt"
205"../getPathPosixEscaped/Makefile"
206"../getPathPosixEscaped/build.sh"
207"../getPathPosixEscaped/cmake_install.cmake"
208"../getPathPosixEscaped/main.F90"
209"../getPathPosixEscaped/main.exe"
210"../getPathPosixEscaped/main.out.F90"
211"../getPathQuoted/CMakeCache.txt"
212"../getPathQuoted/CMakeFiles"
213"../getPathQuoted/CMakeLists.txt"
214"../getPathQuoted/Makefile"
215"../getPathQuoted/build.sh"
216"../getPathQuoted/cmake_install.cmake"
217"../getPathQuoted/main.F90"
218"../getPathQuoted/main.exe"
219"../getPathQuoted/main.out.F90"
220"../getPathSep/CMakeCache.txt"
221"../getPathSep/CMakeFiles"
222"../getPathSep/CMakeLists.txt"
223"../getPathSep/Makefile"
224"../getPathSep/build.sh"
225"../getPathSep/cmake_install.cmake"
226"../getPathSep/main.F90"
227"../getPathSep/main.exe"
228"../getPathSep/main.out.F90"
229"../getPathTemp/CMakeCache.txt"
230"../getPathTemp/CMakeFiles"
231"../getPathTemp/CMakeLists.txt"
232"../getPathTemp/Makefile"
233"../getPathTemp/build.sh"
234"../getPathTemp/cmake_install.cmake"
235"../getPathTemp/main.F90"
236"../getPathTemp/main.exe"
237"../getPathTemp/main.out.F90"
238"../getPathVerbatim/CMakeCache.txt"
239"../getPathVerbatim/CMakeFiles"
240"../getPathVerbatim/CMakeLists.txt"
241"../getPathVerbatim/Makefile"
242"../getPathVerbatim/build.sh"
243"../getPathVerbatim/cmake_install.cmake"
244"../getPathVerbatim/main.F90"
245"../getPathVerbatim/main.exe"
246"../getPathVerbatim/main.out.F90"
247"../getPathVerbatimCMD/CMakeCache.txt"
248"../getPathVerbatimCMD/CMakeFiles"
249"../getPathVerbatimCMD/CMakeLists.txt"
250"../getPathVerbatimCMD/Makefile"
251"../getPathVerbatimCMD/build.sh"
252"../getPathVerbatimCMD/cmake_install.cmake"
253"../getPathVerbatimCMD/main.F90"
254"../getPathVerbatimCMD/main.exe"
255"../getPathVerbatimCMD/main.out.F90"
256"../getPathVerbatimFish/CMakeCache.txt"
257"../getPathVerbatimFish/CMakeFiles"
258"../getPathVerbatimFish/CMakeLists.txt"
259"../getPathVerbatimFish/Makefile"
260"../getPathVerbatimFish/build.sh"
261"../getPathVerbatimFish/cmake_install.cmake"
262"../getPathVerbatimFish/main.F90"
263"../getPathVerbatimFish/main.exe"
264"../getPathVerbatimFish/main.out.F90"
265"../getPathVerbatimPosix/CMakeCache.txt"
266"../getPathVerbatimPosix/CMakeFiles"
267"../getPathVerbatimPosix/CMakeLists.txt"
268"../getPathVerbatimPosix/Makefile"
269"../getPathVerbatimPosix/build.sh"
270"../getPathVerbatimPosix/cmake_install.cmake"
271"../getPathVerbatimPosix/main.F90"
272"../getPathVerbatimPosix/main.exe"
273"../getPathVerbatimPosix/main.out.F90"
274"../getPathVerbatimPowerShell/CMakeCache.txt"
275"../getPathVerbatimPowerShell/CMakeFiles"
276"../getPathVerbatimPowerShell/CMakeLists.txt"
277"../getPathVerbatimPowerShell/Makefile"
278"../getPathVerbatimPowerShell/build.sh"
279"../getPathVerbatimPowerShell/cmake_install.cmake"
280"../getPathVerbatimPowerShell/main.F90"
281"../getPathVerbatimPowerShell/main.exe"
282"../getPathVerbatimPowerShell/main.out.F90"
283"../getPathWindows/CMakeCache.txt"
284"../getPathWindows/CMakeFiles"
285"../getPathWindows/CMakeLists.txt"
286"../getPathWindows/Makefile"
287"../getPathWindows/build.sh"
288"../getPathWindows/cmake_install.cmake"
289"../getPathWindows/main.F90"
290"../getPathWindows/main.exe"
291"../getPathWindows/main.out.F90"
292
293
294css = glob(SK_'./*.F90')
295reshape(css, [size(css), 1])
296"./main.F90"
297"./main.out.F90"
298
299
300glob(SK_'./*.nonexistent')
301
302
303
Test:
test_pm_sysPath
Todo:
High Priority: The current Fortran standard 202x does not allow passing characters of non-default kind to the intrinsic Fortran statements and procedures.
As such, the implementation of the procedures of this generic interface for non-default character kinds leads to compile-time kind mismatch errors.
This procedure should be converted back to a generic interface in the future when non-default character kinds are also fully supported by the intrinsic functions.


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, Tuesday March 7, 2017, 7:03 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin

Definition at line 954 of file pm_sysPath.F90.


The documentation for this interface was generated from the following file: