files_to_convert {basepenguins}R Documentation

List files to convert in a directory

Description

This function lists all files in a directory (and subdirectories) that match the specified file extensions. It can be used as a helper to find files paths to pass to convert_files() and convert_files_inplace(), or to preview which files those functions, as well as convert_dir() and convert_dir_inplace() will look to convert. It can also be used as input to output_paths() to help generate output paths for new files.

Usage

files_to_convert(
  dir,
  full.names = FALSE,
  extensions = c("R", "r", "qmd", "rmd", "Rmd")
)

Arguments

dir

A character string specifying the directory path to search

full.names

Logical. If TRUE, returns full file paths rather than relative paths. Default is FALSE.

extensions

A character vector of file extensions to filter by. Default is c("R", "r", "qmd", "rmd", "Rmd"). If NULL or empty, returns all files.

Value

A character vector of file paths that match the specified extensions.

See Also

convert_files(), convert_files_inplace(), convert_dir(), convert_dir_inplace(), output_paths().

Examples

example_dir <- example_dir() # Get examples directory
files_to_convert(example_dir)
files_to_convert(example_dir, full.names = TRUE)
files_to_convert(example_dir, extensions = "R")
files_to_convert(example_dir, extensions = NULL) # all files


[Package basepenguins version 0.1.0 Index]