Skip to contents

Retrieves names, timestamps, and sizes of files and folders inside local project folder.

Usage

cloud_local_ls(
  path = "",
  root = ".",
  recursive = FALSE,
  full_names = FALSE,
  ignore = TRUE
)

Arguments

path

(optional) Path, relative to the specified root to list contents of. By default, when path = "", lists root-level files and folders.

root

Local directory path relative to which all other paths are considered.

recursive

(logical) If TRUE, lists contents recursively in all nested subfolders. Default is FALSE.

full_names

(logical) If TRUE, folder path is appended to object names to give a relative file path.

ignore

Logical flag indicating whether to ignore certain directories. Currently, if set to TRUE, the 'renv' folder is ignored due to its typically large size. This parameter may be expanded in the future to support more complex ignore patterns.

Value

A tibble containing the names, last modification timestamps, and sizes in bytes of files and folders inside the specified local folder.

Examples

# list only root-level files and folders
cloud_local_ls() 
#> # A tibble: 28 × 4
#>    name                    type  last_modified       size_b
#>    <chr>                   <chr> <dttm>               <int>
#>  1 Rplot001.png            png   2024-05-07 16:47:14   1011
#>  2 check_args.html         html  2024-05-07 16:47:07   7872
#>  3 check_bool.html         html  2024-05-07 16:47:07   9077
#>  4 check_class.html        html  2024-05-07 16:47:07   8993
#>  5 check_length.html       html  2024-05-07 16:47:07   8976
#>  6 check_null_cond.html    html  2024-05-07 16:47:07   8595
#>  7 check_path.html         html  2024-05-07 16:47:07   8446
#>  8 check_scalar.html       html  2024-05-07 16:47:08   8437
#>  9 cli_yeah.html           html  2024-05-07 16:47:08   9868
#> 10 cloud_drive_attach.html html  2024-05-07 16:47:08  10094
#> # ℹ 18 more rows

# list all files in all nested folders
cloud_local_ls(recursive = TRUE)
#> # A tibble: 30 × 4
#>    name                    type  last_modified       size_b
#>    <chr>                   <chr> <dttm>               <int>
#>  1 Rplot001.png            png   2024-05-07 16:47:14   1011
#>  2 check_args.html         html  2024-05-07 16:47:07   7872
#>  3 check_bool.html         html  2024-05-07 16:47:07   9077
#>  4 check_class.html        html  2024-05-07 16:47:07   8993
#>  5 check_length.html       html  2024-05-07 16:47:07   8976
#>  6 check_null_cond.html    html  2024-05-07 16:47:07   8595
#>  7 check_path.html         html  2024-05-07 16:47:07   8446
#>  8 check_scalar.html       html  2024-05-07 16:47:08   8437
#>  9 cli_yeah.html           html  2024-05-07 16:47:08   9868
#> 10 cloud_drive_attach.html html  2024-05-07 16:47:08  10094
#> # ℹ 20 more rows

if (FALSE) {
# list contents of "plots/barplots" subfolder (if it exists)
cloud_local_ls("plots/barplots")
}