I’m finding R to be a useful tool for managing and processing multiple raster files. The example shown below shows the code I put together for running a sum function (i.e. adding together) on 12 raster files using a R raster stack (a collection of RasterLayer objects).

#import required libraries
library(raster)
library(rgdal)

#generate a list of input rasters ("grids")
#pattern = "*.tif$" - filters for main raster files only and skips any associated files (e.g. world files)
grids <- list.files("./Path/To/Data" , pattern = "*.tif$")

#create a raster stack from the input raster files 
s <- raster::stack(paste0("./Path/To/Data", grids))

#run the sum function on the raster stack - i.e. add (non-cumulatively) the rasters together
r <- sum(s)

#write the output raster to file
r <- writeRaster(r, filename = "./Path/For/Export/Filename", format="GTiff", overwrite=TRUE)