How do I get a list of subdirectories only, not files, in a directory dir.create("test") setwd("test") dir.create("adir") dir.create("bdir") file.create("afile") dir() returns [1] "adir" "afile" "bdir" in need to return [1] "adir" "bdir" cheers Nevil Amos
Henrique Dallazuanna
2010-Jun-02 02:12 UTC
[R] How to get a list of subdirectories in the wd?
Try this: dir()[file.info(dir())$isdir] On Tue, Jun 1, 2010 at 11:06 PM, Nevil Amos <nevil.amos@gmail.com> wrote:> How do I get a list of subdirectories only, not files, in a directory > > > dir.create("test") > setwd("test") > dir.create("adir") > dir.create("bdir") > file.create("afile") > dir() > > returns [1] "adir" "afile" "bdir" > > in need to return [1] "adir" "bdir" > > cheers > > Nevil Amos > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]