Created
May 1, 2024 07:42
-
-
Save jjesusfilho/8d436c448ed4ae5b6ba0a46f7415ab02 to your computer and use it in GitHub Desktop.
Retorna o tamanho dos diretórios
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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