Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

split_path

Split file path into individual components (optionally including separators)


Description

Split file path into individual components (optionally including separators)

Usage

split_path(path, include.fseps = FALSE, omit.duplicate.fseps = FALSE,
  fsep = .Platform$file.sep)

Arguments

path

A path with directories separated by fseps.

include.fseps

Whether to include the separators in the returned character vector (default FALSE)

omit.duplicate.fseps

Whether to omit duplicate file separators if include.fseps=TRUE (default FALSE).

fsep

The path separator (default to .Platform$file.sep)

Value

A character vector with one element for each component in the path (including path separators if include.fseps=TRUE).

See Also

Other path_utils: abs2rel; common_path

Examples

split_path("/a/b/c")
split_path("a/b/c")
parts=split_path("/a/b/c", include.fseps=TRUE)
# join parts back up again
paste(parts, collapse = "")
split_path("a/b//c", include.fseps=TRUE, omit.duplicate.fseps=TRUE)
# Windows style
split_path("C:\\a\\b\\c", fsep="\\")

nat.utils

File System Utility Functions for 'NeuroAnatomy Toolbox'

v0.5.1
GPL-3
Authors
Gregory Jefferis
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.