Examples for 'fs::dir_ls'


List files

Aliases: dir_ls dir_map dir_walk dir_info

Keywords:

### ** Examples

## Don't show: 
.old_wd <- setwd(tempdir())
## End(Don't show)
dir_ls(R.home("share"), type = "directory")
/usr/local/R/4.2/share/R            /usr/local/R/4.2/share/Rd           
/usr/local/R/4.2/share/dictionaries /usr/local/R/4.2/share/encodings    
/usr/local/R/4.2/share/java         /usr/local/R/4.2/share/licenses     
/usr/local/R/4.2/share/make         /usr/local/R/4.2/share/sh           
/usr/local/R/4.2/share/texmf        
# Create a shorter link
link_create(system.file(package = "base"), "base")

dir_ls("base", recurse = TRUE, glob = "*.R")
base/demo/error.catching.R base/demo/is.things.R      
base/demo/recursion.R      base/demo/scoping.R        
# If you need the full paths input an absolute path
dir_ls(path_abs("base"))
/tmp/Rtmpul02DQ/base/CITATION    /tmp/Rtmpul02DQ/base/DESCRIPTION 
/tmp/Rtmpul02DQ/base/INDEX       /tmp/Rtmpul02DQ/base/Meta        
/tmp/Rtmpul02DQ/base/R           /tmp/Rtmpul02DQ/base/demo        
/tmp/Rtmpul02DQ/base/help        /tmp/Rtmpul02DQ/base/html        
dir_map("base", identity)
[[1]]
[1] "base/CITATION"

[[2]]
[1] "base/DESCRIPTION"

[[3]]
[1] "base/INDEX"

[[4]]
[1] "base/Meta"

[[5]]
[1] "base/R"

[[6]]
[1] "base/demo"

[[7]]
[1] "base/help"

[[8]]
[1] "base/html"
dir_walk("base", str)
 chr "base/CITATION"
 chr "base/DESCRIPTION"
 chr "base/INDEX"
 chr "base/Meta"
 chr "base/R"
 chr "base/demo"
 chr "base/help"
 chr "base/html"
dir_info("base")
# A tibble: 8 × 18
  path        type    size permissions modification_time   user  group device_id
  <fs::path>  <fct> <fs::> <fs::perms> <dttm>              <chr> <chr>     <dbl>
1 …e/CITATION file     956 rw-r--r--   2024-11-28 07:31:58 root  root      64513
2 …ESCRIPTION file     354 rw-r--r--   2024-11-28 07:31:58 root  root      64513
3 base/INDEX  file   23.8K rw-r--r--   2024-11-28 07:31:58 root  root      64513
4 base/Meta   dire…     4K rwxr-xr-x   2024-11-28 07:31:58 root  root      64513
5 base/R      dire…     4K rwxr-xr-x   2024-11-28 07:31:58 root  root      64513
6 base/demo   dire…     4K rwxr-xr-x   2024-11-28 07:31:58 root  root      64513
7 base/help   dire…     4K rwxr-xr-x   2024-11-28 07:31:58 root  root      64513
8 base/html   dire…     4K rwxr-xr-x   2024-11-28 07:31:58 root  root      64513
# … with 10 more variables: hard_links <dbl>, special_device_id <dbl>,
#   inode <dbl>, block_size <dbl>, blocks <dbl>, flags <int>, generation <dbl>,
#   access_time <dttm>, change_time <dttm>, birth_time <dttm>
# Cleanup
link_delete("base")
## Don't show: 
setwd(.old_wd)
## End(Don't show)

[Package fs version 1.6.5 Index]