Skip to content

Instantly share code, notes, and snippets.

@joelnitta
Created September 8, 2021 01:53
Show Gist options
  • Save joelnitta/2fd5d05fdf9c0910551f4af54d0df884 to your computer and use it in GitHub Desktop.
Save joelnitta/2fd5d05fdf9c0910551f4af54d0df884 to your computer and use it in GitHub Desktop.
Make a list of MD5 checksums for files in a folder
library(tidyverse)
# Specify directory with files to get checksums
dir <- "my_folder"
# Get checksums
list.files(dir, full.names = TRUE) %>%
tools::md5sum() %>%
tibble(file = names(.), checksum = .) %>%
filter(!is.na(checksum)) %>%
mutate(
file = fs::path_file(file),
text = glue::glue("{file}: {checksum}")) %>%
arrange(file) %>%
pull(text) %>%
cat(sep = "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment