util_search_pattern: Search for Files using Regular Expression

Description Usage Arguments Author(s) Examples

View source: R/util_search.R

Description

Searches for files in dir using file name regular expression pattern.

Usage

1
2
3
4
5
6
7
8
9
util_search_pattern(
  dir = getwd(),
  pattern = "^file.*\\.csv$",
  all.files = FALSE,
  full.names = TRUE,
  recursive = FALSE,
  ignore.case = TRUE,
  no.. = FALSE
)

Arguments

dir

Character string. Directory to search.

pattern

an optional regular expression. Only file names which match the regular expression will be returned.

all.files

a logical value. If FALSE, only the names of visible files are returned (following Unix-style visibility, that is files whose name does not start with a dot). If TRUE, all file names will be returned.

full.names

a logical value. If TRUE, the directory path is prepended to the file names to give a relative file path. If FALSE, the file names (rather than paths) are returned.

recursive

logical. Should the listing recurse into directories?

ignore.case

logical. Should pattern-matching be case-insensitive?

no..

logical. Should both "." and ".." be excluded also from non-recursive listings?

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

1
2
3
4
5
6
7
# Search for files in the working directory
# with filenames starting with `file`
# and ending with `.csv`.
util_search_pattern(
  dir = getwd(),
  pattern = "^file.*\\.csv$"
)

jeksterslabds/jeksterslabRutils documentation built on Jan. 18, 2021, 11:41 p.m.