findtxt {findR}R Documentation

Find text files by content with pattern matching

Description

findtxt scans all directories and subdirectories of a given path for text files (.txt) containing a specific pattern. Hits can be copied to a new folder.

Usage

findtxt(pattern = "Hello World", path = ".", case.sensitive = TRUE,
  show.results = TRUE, copy = FALSE, folder = "findtxt",
  overwrite = TRUE)

Arguments

pattern

a pattern (regular expression) to search for.

path

a character vector, path to be scanned. The default corresponds to the working directory, getwd().

case.sensitive

a logical value. If TRUE, pattern-matching is case-sensitive.

show.results

a logical value. If TRUE, results are printed after completion.

copy

a logical value. If TRUE, all matching text files are copied to folder.

folder

a character vector, path or name of new folder to copy matching text files to.

overwrite

a logical value. If TRUE, existing destination files are overwritten.

Examples

# Find all text files in the package folder that contain the name Einstein
findtxt(path = system.file(package = "findR"), pattern = "Einstein")

# Save results in a data frame and show hits
dt <- findtxt(path = system.file(package = "findR"), pattern = "Einstein", show.results = TRUE)
dt


[Package findR version 0.2.1 Index]