[R] list.files, recursively

jim holtman
2012-11-18T21:59:17Z

You can do the following to remove the directory names from the list:


setdiff(list.files(full.names = TRUE), list.dirs(recursive = FALSE))


On Sun, Nov 18, 2012 at 12:20 PM, Jannis <bt_jannis at yahoo.de>
wrote:
> Dear R developers,
>
>
> as far as I understand the manual of list.files(), there is only a way to
> exclude directories from the returned vector if you use list.files
> recursively. In non recursive mode, there seems to be no way of excluding
> directories (the include dirs argument does not seem to have any effect).
> Would it not be more intuitive and practical to allow the switching off of
> directory names in both cases?
>
>
> Thanks a lot
> Jannis
>
> ______________________________________________
> R-help at 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.



--
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.