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.
See also
Other file functions:
identify_blank_line_neighbors(),
normalize_hashtags(),
peek_csv_file(),
remove_blank_line_dups(),
replace_in_file(),
sort_files_by_size(),
split_file(),
split_files_by_size(),
zip_files_by_pattern()
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-1dc25597484a"
#> [1] "test-test-***" # Expected