Skip to content

Instantly share code, notes, and snippets.

@mhweber
Created April 29, 2025 19:18
Show Gist options
  • Save mhweber/93a45368f432e1e91d52cd0a505cc10d to your computer and use it in GitHub Desktop.
Save mhweber/93a45368f432e1e91d52cd0a505cc10d to your computer and use it in GitHub Desktop.
Read and combine all files in a directory and write back
# in this example I'm looking for files with the name patter 'filename' that happen to be .zip files
mydir <- "my/dir/space"
pattern <- "filename"
FileList <- list.files(path = mydir, pattern = pattern, full.names = TRUE)
result <- purrr::map(FileList,~read_csv(.))
result <- bind_rows(result)
write_parquet(result,'mydir/myfile.parquet')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment