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 directories, how would I do this? Is it somehow right in front of me as an option within list.files()
?
Also, I'm using Windows, so if the answer is to shell out to some Linux/unix command, that won't work for me.
.NET for example has a Directory.GetFiles()
method, and a separate Directory.GetDirectories()
method, so I figured R would have an analogous pair. Thanks in advance.
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: