The glob call provides a sorted list of path names matched by the pattern. It also contains a number of fields that record information about the scan, including a pointer to a word vector (pglob->gl_pathv)…