Add file extension to all files in R folder
2 answers
With the help of the function, list.files
you can get the names of files at a given path and with a given pattern. Of these, you can use paste
to add the file extension and the next file.rename
one to rename the files. For example:
oldNames<-list.files(...) #some argument here
newNames<-paste(sep="",oldNames,".png")
for (i in 1:length(oldNames)) file.rename(oldNames[i],newNames[i])
+4
source to share