Welcome @walter1 in the RStudio Community.
I am not sure what is exactly the problem you are meeting and therefore the code below is maybe only a starting point for a solution. I hope it will help.
# create subfolder and (two) testfiles
fs::dir_create("./aranceles")
df1= data.frame(
A=c(1,2,3,4),
B=c(1,2,3,4),
C=c(1,2,3,4),
D=c(1,2,3,4)
)
df2= data.frame(
A=c(4,3,1,1),
B=c(4,3,1,1),
C=c(4,3,1,1),
D=c(4,3,1,1)
)
write.csv(df1,'./aranceles/myfile1.txt',row.names = FALSE)
write.csv(df2,'./aranceles/mijnbestand.txt',row.names = FALSE)
# suggested solution for your code
# working with csv files and NOT xls files
l<-list.files("./aranceles")
finaldf = data.frame()
for (fn in l) {
x1<- read.csv(paste0("./aranceles/",fn))
finaldf <- rbind(finaldf,x1)
}
print(finaldf)
A B C D
1 4 4 4 4
2 3 3 3 3
3 1 1 1 1
4 1 1 1 1
5 1 1 1 1
6 2 2 2 2
7 3 3 3 3
8 4 4 4 4