normalize_names() normalizes file and directory names to make them
machine-readable.
This function uses dir_ls() to list files/directories to
rename, along with make_machine_readable()
to rename files.
Usage
normalize_names(
path = clipr::read_clip(),
regexp = "^README|^OFL|^DESCRIPTION|^Google README",
invert = TRUE,
...
)Arguments
- path
(optional) A
characterstring indicating the directory path. Defaults to clipboard content.- regexp
(optional) A
characterstring with a regular expression to filter files/directories to rename (default:"^README|^OFL.txt$|^DESCRIPTION|^Google README.txt$").- invert
(optional) A
logicalflag indicating if the regular expression inregexshould be negated (default:TRUE).- ...
(optional) Additional arguments to be passed to
dir_ls()while listing files/directories to rename.
Examples
dir <- tempfile("")
dir.create(dir) |> invisible()
file <- tempfile("Test - Test-", tmpdir = dir)
file.create(file) |> invisible()
normalize_names(dir)
list.files(dir)
#> [1] "test-test-1ad55aa81cb0"
#> [1] "test-test-***" # Expected