R/fct_other.R

Defines functions list.dirs.depth.n

Documented in list.dirs.depth.n

#' List directories in folder 
#'
#' @param p string path of directory.  Default = '.'
#' @param n integer value indicating the folder depth to search
#'
#' @return vector of strings containing the paths to the directories
#' @export
list.dirs.depth.n <- function(p, n) {
  res <- list.dirs(p, recursive = FALSE)
  if (n > 1) {
    add <- list.dirs.depth.n(res, n-1)
    c(res, add)
  } else {
    res
  }
}
scottwalmsley/wSIMCity documentation built on May 3, 2021, 2:35 p.m.