Skip to content

sol_glob() ​

idl
;+
; :Returns: any
;-
result = sol_glob(root, include, exclude, $
  count = value)

Finds files under a root folder using glob patterns, like the include and exclude lists of the idltest.json file.

Pattern syntax, matched against the path of each file relative to root:

  • * matches any number of characters within one folder or file name.
  • ? matches exactly one character within one folder or file name.
  • ** as a whole folder name (src/**/*.pro) matches zero or more folders.
  • A pattern ending in / matches everything below that folder.
  • / and \ can both be used as separators in patterns.
  • Matching is case-insensitive on Windows and case-sensitive elsewhere.
  • Parent folder references (..) are not supported.

A file is returned if it matches at least one include pattern and no exclude pattern.

Examples ​

Find all of the PRO files under src, excluding the tests:

idl
files = sol_glob(dir, 'src/**/*.pro', '**/*.spec.pro', count = count)

Arguments ​

root ​

requiredinputtype=String

Folder that the patterns are relative to.

include ​

optionalinputtype=String | Array<String>

Patterns for the files to return. Nothing is returned if not specified.

exclude ​

optionalinputtype=String | Array<String>

Patterns for the files to remove from the results.

Keywords ​

count ​

optionaloutputtype=Long

Set to a named variable to retrieve the number of files returned.

Licensed under MIT.