Sys.glob
Wildcard Expansion on File Paths

Description

Use shell pattern matching to select files

Usage

Sys.glob(paths, dirmark = FALSE)

Arguments

paths Character strings specifying paths to files, where each component of the path may be a shell pattern.
dirmark A logical value. If TRUE append a slash to the end of names of directories.

Details

The pattern language is based on that of the bash shell. An asterisk matches zero or more characters, a question mark represents one character, and a collection of characters within square brackets matches any one of those characters. Inside of square brackets you may also use x-y to mean any of the characters between x and y, ordered in the ASCII order.
Value
A character vector containing paths to files that match the patterns in the input paths.
Examples
Sys.glob(file.path(.libPaths(), "[k-m]*", "DESCRIPTION"))
Sys.glob(file.path(R.home(), "*library"), dirmark=TRUE)
Package base version 6.0.0-69
Package Index