Skip to content

Instantly share code, notes, and snippets.

@summerofgeorge
Last active October 29, 2019 10:08
Show Gist options
  • Save summerofgeorge/aa03aade182f7fe2b6ebdf7afe95cc05 to your computer and use it in GitHub Desktop.
Save summerofgeorge/aa03aade182f7fe2b6ebdf7afe95cc05 to your computer and use it in GitHub Desktop.
Rename all jpg files in a folder
# List the jpg files in the folder
old_files <- list.files("C:/ImageTest", pattern = "*.JPG", full.names = TRUE)
old_files
# Create vector of new files
new_files <- paste0("C:/NewFiles/file_",1:length(old_files),".JPG")
new_files
# Copy from old files to new files
file.copy(from = old_files, to = new_files)
# Clear out the old files
#file.remove(old_files)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment