Re: [R] list.files recursively to find files in a specific way...

2011-07-20 Thread Keith Jewell
I don't think the OP specified an operating system, but... A few weeks ago I had a closely analogous problem, seeking files 'menus.txt' in subdirectories 'etc' but not from other subdirectories; '/etc/menus.txt'. I made this post , but

Re: [R] list.files recursively to find files in a specific way...

2011-07-19 Thread Prof Brian Ripley
But using the approproate tool, Sys.glob, whould be much simpler. Note that 'pattern' in list.files is - a regexp, and '.' is a special character in a regexp: Phil's solution also needs to escape it or use fixed = TRUE - it is documented to match file *names*, not file paths. One of the autho

Re: [R] list.files recursively to find files in a specific way...

2011-07-19 Thread Phil Spector
Pei - A file pattern can't contain a directory separator, but it's easy to search for one outside the context of list.files. I think grep('B/file2.txt',list.files(path = routeStr, all.files = TRUE, full.names = TRUE, recursive = TRUE),value=TRUE) should give y

[R] list.files recursively to find files in a specific way...

2011-07-19 Thread JIA Pei
Hi, all: My folders are organized in such a way: root branch1 ---A ---file1.txt ---file2.txt ---B ---file1.txt ---file2.txt branch2 ---A ---file1.txt