Helper function to find the roots of absolute paths. Tries to put absolute paths into the context of the relative root. For those that this is not possible (because they are not in fact a sub-path of the relative roots), identifies the greatest common denominator for absolute paths as their root. Does not change relative paths but does check whether they do exist if check_existence = TRUE (the default). To modify relative paths, use iso_shorten_relative_paths prior to calling this function.

iso_find_absolute_path_roots(path, root = ".", check_existence = TRUE)



vector of file/folder paths, mixed relative and absolute paths are allowed.


root directory for the isofiles. Can be relative to the current working directory (e.g. "data") or an absolute path on the file system (e.g. "/Users/..." or "C:/Data/.."). The default is the current working directory ("."). Can be supplied as a vector of same length as the provided paths if the paths have different roots.


whether to check for the existence of the paths


a data frame with the root directories and paths relative to the root - order of input paths is preserved

See also

Other file system functions: iso_expand_paths(), iso_root_paths(), iso_shorten_relative_paths()