R is certainly not the natural tool you would use for this, but with effort it 
could be done, I think.

dir(..., recursive = TRUE)

will list files descending down a directory tree.  You may then need to use 
things like basename() to strip off the directory names, grep() to search for 
the keyword, setdiff(..,..) to find which are missing, file.copy() to do the 
copying.

This is probably not the usual entry point to R, though.

Bill Venables
http://www.cmis.csiro.au/bill.venables/ 


-----Original Message-----
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Daniel Bradley
Sent: Wednesday, 22 April 2009 12:23 PM
To: R-help@r-project.org
Subject: [R] Finding and moving files

Hi!

I'm at the very beggining of my R experience and I'm hoping someone can
point me in the right direction.  I want to create a script that locates all
files within a directory tree that have certain keywords in their file
names, checks these against files in another location, then copies files
that don't already exist in that other location.

I'm currently tralling through the help reference but I've yet to find
anything that might do the trick.  Any ideas?

Thanks!
Dan

        [[alternative HTML version deleted]]

______________________________________________
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.

______________________________________________
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.

Reply via email to