Print the directory structure of a given path in a tree-like format. Optionally, save the result to a log file for record keeping or debugging.
Usage
file_tree(
path = ".",
max_depth = 2,
log = FALSE,
log_path = "logs/tree",
file_name = NULL,
append = FALSE
)
Arguments
- path
Character. The target root directory path to print. Default is
"."
.- max_depth
Integer. Maximum depth of recursion into subdirectories. Default is
2
.- log
Logical. Whether to save the tree output as a log file. Default is
FALSE
.- log_path
Character. Directory path to save the log file if
log = TRUE
. Default is"logs/tree"
.- file_name
Character. Custom file name for the log file. If
NULL
, a name like"file_tree_YYYYMMDD_HHMMSS.log"
will be used.- append
Logical. If
TRUE
, appends to an existing file (if present). IfFALSE
, overwrites the file. Default isFALSE
.
Examples
file_tree()
#>
#> ── 📂 Directory Tree: F:\Projects\evanverse\docs\reference ─────────────────────
#> ├── any_void.html
#> ├── bio_palette_gallery.html
#> ├── check_pkg.html
#> ├── cols_with_void.html
#> ├── combine_logic.html
#> ├── compile_palettes.html
#> ├── convert_gene_id.html
#> ├── create_palette.html
#> ├── df2list.html
#> ├── download_gene_ref.html
#> ├── download_url.html
#> ├── drop_void.html
#> ├── ev_download.html
#> ├── evanverse-package.html
#> ├── evanverse.html
#> ├── file_info.html
#> ├── file_tree.html
#> ├── get_ext.html
#> ├── get_palette.html
#> ├── gmt2df.html
#> ├── gmt2list.html
#> ├── grapes-is-grapes.html
#> ├── grapes-nin-grapes.html
#> ├── grapes-p-grapes.html
#> ├── hex2rgb.html
#> ├── index.html
#> ├── inst
#> │ └── extdata
#> ├── inst_pkg.html
#> ├── is_void.html
#> ├── list_palettes.html
#> ├── logs
#> │ └── palettes
#> ├── pkg_version.html
#> ├── plot_pie.html
#> ├── plot_venn-1.png
#> ├── plot_venn-2.png
#> ├── plot_venn-3.png
#> ├── plot_venn-4.png
#> ├── plot_venn-5.png
#> ├── plot_venn.html
#> ├── preview_palette.html
#> ├── remind.html
#> ├── replace_void.html
#> ├── rgb2hex.html
#> ├── rows_with_void.html
#> ├── update_pkg.html
#> └── with_timer.html
file_tree("data", max_depth = 3, log = TRUE)
#> ✖ ❌ Directory does not exist: F:\Projects\evanverse\docs\reference\data