How to obtain a list of directories within a directory, like list.files(), but instead “list.dirs()”

后端 未结 7 613
梦如初夏
梦如初夏 2021-01-30 12:14

This may be a very easy question for someone - I am able to use list.files() to obtain a list of files in a given directory, but if I want to get a list of director

相关标签:
7条回答
  • 2021-01-30 13:11

    Just to update this thread:

    I see that in the newer version of R (currently I'm using 2.5.1), there is now a list.dirs function included in the base install:

    list.dirs implicitly has all.files = TRUE, and if recursive = TRUE, the answer includes path itself (provided it is a readable directory).

    0 讨论(0)
提交回复
热议问题