Navigation

Operators and Keywords

Function List:

C++ API

: glob (pattern)

Given an array of pattern strings (as a char array or a cell array) in pattern, return a cell array of filenames that match any of them, or an empty cell array if no patterns match.

The pattern strings are interpreted as filename globbing patterns (as they are used by Unix shells).

Within a pattern

*

matches any string, including the null string,

?

matches any single character, and

[…]

matches any of the enclosed characters.

Tilde expansion is performed on each of the patterns before looking for matching filenames. For example:

ls
  ⇒
     file1  file2  file3  myfile1 myfile1b
glob ("*file1")
  ⇒
     {
       [1,1] = file1
       [2,1] = myfile1
     }
glob ("myfile?")
  ⇒
     {
       [1,1] = myfile1
     }
glob ("file[12]")
  ⇒
     {
       [1,1] = file1
       [2,1] = file2
     }

See also: ls, dir, readdir, what.

Package: octave