using terra package
#Load all files
library(terra) netfiles <- list.files('envdata', pattern = '.nc$', full.names = TRUE) envdata <- rast(netfiles)