ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
webglob.m
Go to the documentation of this file.
1%> \brief
2%> Return a scalar MATLAB string or vector of MATLAB strings
3%> containing the fully-resolved paths matching the input pattern.<br>
4%>
5%> \details
6%> This function is very similar to [pm.sys.path.glob](@ref glob).<br>
7%> However, unlike [pm.sys.path.glob](@ref glob), if the input
8%> pattern matches a World Wide Web link, it will also
9%> download the file to a temporary path on the system
10%> and the temporary download path as the output.<br>
11%>
12%> \param[in] pattern : The input scalar MATLAB string containing either:<br>
13%> <ol>
14%> <li> the pattern to search for paths on the current system.<br>
15%> Wildcards may be used for basenames and for the directory parts.<br>
16%> If pattern contains directory parts, then these will
17%> be included in the output ``pathList``.<br>
18%> Following wildcards can be used:<br>
19%> <ol>
20%> <li> ``*`` match zero or more characters.<br>
21%> <li> ``?`` match any single character.<br>
22%> <li> ``[ab12]`` match one of the specified characters.<br>
23%> <li> ``[^ab12]`` match none of the specified characters.<br>
24%> <li> ``[a-z]`` match one character in range of characters.<br>
25%> <li> ``{a,b,c}`` matches any one of strings ``a``, ``b``, or ``c``.<br>
26%> <li> All above wildcards do not match a file separator.<br>
27%> <li> ``**`` match zero or more characters including file separators.<br>
28%> This can be used to match zero or more directory parts
29%> and will recursively list matching names.<br>
30%> </ol>
31%> <li> the weblink to download and save locally on the system temporary folder.<br>
32%> </ol>
33%> \param[in] anycase : The input scalar MATLAB logical.<br>
34%> If ``true``, the search will be case-sensitive.<br>
35%> If ``false``, the search will be case-insensitive.<br>
36%> On Windows, ``anycase`` is always reset to ``true`` even if user-specified.<br>
37%> (**optional**. default = ``false`` on Unix and ``true`` on Windows.)
38%>
39%> \return
40%> ``pathList`` : The output MATLAB cell array of strings containing the files
41%> or directories that match the path specified by string ``pattern``.<br>
42%> ``isdirList`` : The output MATLAB cell array of the same size as ``pathList``,
43%> each element of which is a MATLAB logical value that is ``true`` if
44%> and only if the corresponding element of ``pathList`` is a directory.<br>
45%>
46%> \warning
47%> Symbolic linked directories or junctions may cause an infinite loop when using the ``**``.<br>
48%>
49%> \interface{webglob}
50%> \code{.m}
51%>
52%> [pathList, isdirList] = pm.sys.path.webglob(pattern)
53%> [pathList, isdirList] = pm.sys.path.webglob(pattern, anycase)
54%>
55%> \endcode
56%>
57%> \example{webglob}
58%> \include{lineno} example/sys/path/webglob/main.m
59%> \output{webglob}
60%> \include{lineno} example/sys/path/webglob/main.out.m
61%>
62%> \final{webglob}
63%>
64%> \author
65%> \JoshuaOsborne, May 21 2024, 5:10 AM, University of Texas at Arlington<br>
66%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
67%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
68function [pathList, isdirList] = webglob(pattern, anycase)
69 if nargin < 2
70 anycase = [];
71 end
72 [pathList, isdirList] = pm.sys.path.glob(pattern, anycase);
73 if isempty(pathList)
74 %%%%
75 %%%% check if the input path is a weblink.
76 %%%%
77 if pm.web.isurl(pattern)
78 %%%%
79 %%%% Extract the weblink file name.
80 %%%%
81 parts = split(pattern, "/");
82 if parts(end) ~= ""
83 pathtmp = fullfile(tempdir(), parts(end));
84 else
85 pathtmp = tempname();
86 end
87 pathList = [string(websave(pathtmp, pattern))];
88 end
89 end
90end
function name(in vendor)
Return the MPI library name as used in naming the ParaMonte MATLAB shared library directories.
function list()
Return a list of MATLAB strings containing the names of OS platforms supported by the ParaMonte MATLA...
function glob(in pattern, in anycase)
Find all files and directory names matching the input pattern by expanding wildcards.
function webglob(in pattern, in anycase)
Return a scalar MATLAB string or vector of MATLAB strings containing the fully-resolved paths matchin...
function which(in vendor)
Return the a MATLAB string containing the path to the first mpiexec executable binary found in system...