RStudio gets extremely slow while reading updating many shp files

In RStudio, I wrote a program to read a large number of shp files and save only some columns from each shp file.

There are about 20 shp files in the folder, and each shp file is about 100-300 MB in size.

However, as I read more files, the speed becomes extremely slow, and it takes tens of minutes to read and process a single file.

What could be the problem?
Below is the program I wrote...



files <- Sys.glob("*.shp")

for (filename in files) {

cadastral <- st_read(filename,options="encoding=cp949")
cadastral <- subset(cadastral, select = c(A0,A2,A3,A5,A7,A20))
st_write(cadastral, filename, append=FALSE)

That is probably the problem. Do you get the same issue if you're using desktop GIS software?

When I ran this with QGIS desktop, it's really slow as well.