[R] listing the files in a directory using regular expressions

Rui Barradas ruipbarradas at sapo.pt
Sun Oct 14 11:36:58 CEST 2012


Try the pattern "A_B.*_C.*\\.csv".

Hope this helps,

Rui Barradas
Em 14-10-2012 08:13, siddu479 escreveu:
> Hi Experts,
>    This might be silly question that I am asking, but no way as I am new to
> R.
> I want to list the files in a directory using regular expression like
> A_B*_C*.csv  etc.
> How to make this possible in R ?
> I tried like this list.files(dir=".", pattern="A_B*_C*.csv") but this gives
> no output, whereas list.files(.... pattern="*.csv") giving all the .csv
> files in the output, which I do not want.
> Thanks
> Sidda
> --
> View this message in context: http://r.789695.n4.nabble.com/listing-the-files-in-a-directory-using-regular-expressions-tp4646119.html
> Sent from the R help mailing list archive at Nabble.com.
> ______________________________________________
> 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.

More information about the R-help mailing list