Closed brancengregory closed 1 year ago
library(tidyverse)
clean_file_names <- function(dir) { if(!dir.exists(dir)) { stop("Directory does not exist") }
files <- list.files(dir, full.names = T)
new_files <- files |> str_to_lower() |> str_replaceall(" ", "")
lookups <- tibble( files, new_files ) |> rename( from = files, to = new_files )
lookups |> pwalk(file.rename) }
This should be implemented in ojoutils
library(tidyverse)
clean_file_names <- function(dir) { if(!dir.exists(dir)) { stop("Directory does not exist") }
files <- list.files(dir, full.names = T)
new_files <- files |> str_to_lower() |> str_replaceall(" ", "")
lookups <- tibble( files, new_files ) |> rename( from = files, to = new_files )
lookups |> pwalk(file.rename) }