Shapefiles can mean many things - are they ESRI shapefiles, or other format? Are they individual shp files, or a gdb database? What package are you using to access them? The "old" rgdal & sp workflow, or the "new" sf workflow? Hard to give definite answer without knowing this first.
The start of my approach would be this:
library(rdgal)
shapefiles <- list.files(pattern= '*.shp')
result <- data.frame(names = shapefiles,
rows = c(NA)) # initialize the count
for (i in seq_along(shapefiles)) {
shp <- readOGR(dsn = ".", layer = tools::file_path_sans_ext(shapefiles[i]))
# dot as dsn = assumes current direcotry; layer = filename without extension
result$rows[i] <- nrow(shp@data)
# rows in the data slot of shp as s3 object
}
write.csv(result, "result.csv")