tree: Print the Structure of a Directory Tree

View source: R/util.R

treeR Documentation

Print the Structure of a Directory Tree

Description

Prints the structure of a directory tree up to a specified maximum level of depth. It lists all files and directories under the specified path, displaying them in a tree-like structure.

Usage

tree(path, max.level = 2, level = 0, prefix = "")

Arguments

path

The root path from which to start listing the directory structure.

max.level

The maximum depth of directories to list.

level

Internal parameter used for recursion, indicating the current level of depth.

prefix

Internal parameter used for formatting the printed tree structure.

Value

NULL, called for its side effect of printing the directory structure.

Author(s)

2024-2025 Tobias Schmidt: initial version.

Examples

metabodecon_dir <- system.file(package = "metabodecon")
tree(metabodecon_dir, max.level = 1)

metabodecon documentation built on Nov. 5, 2025, 7:12 p.m.