Learn R Programming

FastUtils (version 0.2.1)

listFiles: List Only Files in a Directory

Description

This function lists only the files in a specified directory, excluding directories. It is useful when you need to process or analyze only the files within a directory without including subdirectories. The base::list.files() function lists both files and directories, so this function provides a more convenient way to obtain just the files.

Usage

listFiles(dirPath, ...)

Value

A character vector of file paths.

Arguments

dirPath

Character. The path to the directory from which to list files.

...

Additional arguments passed to base::list.files() (e.g., pattern, recursive). Note that full.names will be ignored.

Examples

Run this code
# \donttest{
listFiles(getwd())
listFiles(getwd(), pattern = "\\.R$", recursive = TRUE)
# }

Run the code above in your browser using DataLab