5
I am using a loop to extract hundreds of data using unzip. However, I want to rename the files with the same name as the extracted file. I’m making the following code:
zip_postos <- setwd("ZIP_Postos")
zip_postos <- list.files(zip_postos)
postos <- setwd("Postos")
for (i in 1:184){
unzip(zip_postos[[i]], "CHUVAS.MDB", exdir = postos)
file.rename("CHUVAS.MDB", paste(zip_postos[[i]]))
}
I know the code is wrong, but I cannot rename the RAINFALL file to the extracted file name without the format ". zip"
Any suggestions?
Thank you very much! It helped a lot.
– morebru