Return a list of files given a full prefix and optional suffix. Optionally, confirm that the right number of files are returned. If the wrong number of files is returned, throw an error.

match_file(path_prefix, suffix = NULL, expect = NULL)

Arguments

path_prefix

Full path and file prefix

suffix

File suffix, as character (default = `NULL`)

expect

Number of files expected to be returned (default = `NULL`)

Value

Character vector of matched file names, as full paths.

Details

If `path_prefix` points to a directory, then all files inside that directory that match the suffix (if provided) are returned.