syntacticRename: Rename files and/or directories using a syntactic naming...

View source: R/rename.R

syntacticRenameR Documentation

Rename files and/or directories using a syntactic naming function

Description

Rename files and/or directories using a syntactic naming function

Usage

syntacticRename(
  path,
  recursive = FALSE,
  fun = c("kebabCase", "snakeCase", "camelCase", "upperCamelCase"),
  quiet = FALSE,
  dryRun = FALSE
)

Arguments

path

character. File and/or directory paths.

recursive

logical(1). Should the function recurse into directories?

fun

character(1). Function name.

quiet

logical(1). Perform command quietly, suppressing messages.

dryRun

logical(1). Return the proposed file path modifications without modification.

Details

Intelligently deals with a case-insensitive file system, if necessary. This is very useful for macOS and Windows.

Our syntactic naming functions can result in changes that only differ in case, which are problematic on case-insensitive mounts, and require movement of the files into a temporary file name before the final rename.

Value

list. Named list containining from and to rename operations.

Note

Updated 2023-02-06.

Examples

testdir <- AcidBase::tempdir2()
from <- file.path(testdir, c("helloWorld.txt", "fooBar.R"))
file.create(from)
print(basename(from))
output <- syntacticRename(from)
print(output)
AcidBase::unlink2(testdir)

acidgenomics/syntactic documentation built on Oct. 28, 2023, 7:12 a.m.