Skip to contents

File depth

Usage

fileDepth(path)

Arguments

path

character. File path(s). This function is vectorized and supports multiple files.

Value

integer. Unnamed vector denoting file path depth. Note that "/" will return 0 here (zero indexed).

Details

This function intentionally doesn't check whether a file exists.

Note

Updated 2022-05-31.

Examples

a <- tempdir()
b <- tempfile()
fileDepth(c(a, b))
#> [1] 7 8