remove_filename_spaces | R Documentation |
Remove spaces in file names in a specified directory, replacing them with whatever you want, default nothing.
remove_filename_spaces(dir = ".", pattern = "", replacement = "")
dir |
The directory in which to perform the operation. |
pattern |
A regular expression. If specified, only files matching this pattern will be treated. |
replacement |
What do you want to replace the spaces with? This defaults to nothing, another sensible choice would be an underscore. |
A logical vector indicating which operation succeeded for each of the files attempted. Using a missing value for a file or path name will always be regarded as a failure.
## Not run:
dir.create("RemoveFileNameSpaces_test")
setwd("RemoveFileNameSpaces_test")
files <- c("1litres 1.txt", "1litres 30.txt", "3litres 5.txt")
file.create(files)
remove_filename_spaces()
list.files()
setwd("..")
dir.remove("RemoveFileNameSpaces_test")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.