I'm 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 am 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 can not rename the RAW file to the name of the extracted file, without the ".zip" format
Any suggestions?