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

dirs

Get subdirectories


Description

If you want only subfolders and no files, use dirs. With recursive = FALSE, dir returns both folders and files. With recursive = TRUE, it returns only files.

Usage

dirs(path='.', pattern=NULL, exclude=NULL, all.files=FALSE,
     full.names=FALSE, recursive=FALSE, ignore.case=FALSE)

Arguments

path, all.files, full.names, recursive, ignore.case

as for dir

pattern, exclude

optional regular expressions of filenames to include or exclude, respectively.

Details

1. mainDir <- dir(...) without recurse

2. Use file.info to restrict mainDir to only directories.

3. If !recursive, return the restricted mainDir. Else, if length(mainDir) > 0, create dirList to hold the results of the recursion and call dirs for each component of mainDir. Then unlist and return the result.

Value

A character vector of the desired subdirectories.

Author(s)

Spencer Graves

See Also


fda

Functional Data Analysis

v5.1.9
GPL (>= 2)
Authors
J. O. Ramsay <ramsay@psych.mcgill.ca> [aut,cre], Spencer Graves <spencer.graves@effectivedefense.org> [ctb], Giles Hooker <gjh27@cornell.edu> [ctb]
Initial release
2020-12-16

We don't support your browser anymore

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