File Management and Location tools
find_file()
: find a file (exact matches)search_file()
: search for files using wildcard expansion
*
: match zero or more characters?
: match a single character[
: begin a character class or range## starts with capital letter and doesn't end with md/html
search_file("[A-Z]*[!md|html]")
#> [1] "/Users/mwk/R/fml/DESCRIPTION" "/Users/mwk/R/fml/LICENSE"
#> [3] "/Users/mwk/R/fml/NAMESPACE" "/Users/mwk/R/fml/docs/CNAME"
## all .yml files not in docs/
search_file("[!docs]*.yml")
#> [1] "/Users/mwk/R/fml/_pkgdown.yml" "/Users/mwk/R/fml/docs/pkgdown.yml"
## .yml files that start with a dot
search_file(".*.yml")
#> [1] "/Users/mwk/R/fml/.travis.yml"
here()
: smart file paths within projectlist_files()
: list files
## list files in directory
list_files(full = FALSE)
#> [1] "_pkgdown.yml" "codecov.yml" "DESCRIPTION" "fml.Rproj"
#> [5] "LICENSE" "LICENSE.md" "NAMESPACE" "README.md"
#> [9] "README.Rmd"
list_dirs()
: list directories
list_paths()
: list all paths
fp()
: construct file path## build this/that
fp("this", "that")
#> [1] "this/that"
## pipe style
"this" %FP% "that"
#> [1] "this/that"
pe()
: path expansion–converts to canonical form