Skip to content

Instantly share code, notes, and snippets.

@jjesusfilho
Created May 1, 2024 07:42
Show Gist options
  • Save jjesusfilho/8d436c448ed4ae5b6ba0a46f7415ab02 to your computer and use it in GitHub Desktop.
Save jjesusfilho/8d436c448ed4ae5b6ba0a46f7415ab02 to your computer and use it in GitHub Desktop.
Retorna o tamanho dos diretórios
dir_size <- function(x){
purrr::map_dfr(x, purrr::possibly(~{
system(glue::glue("du -s {.x}"), intern = T) |>
stringr::str_split_1("\\s+") |>
setNames(c("tamanho","diretorio"))
},NULL)) |>
dplyr::mutate(tamanho = as.numeric(tamanho))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment