[R] copy directory command
Tony Breyal
tony.breyal at googlemail.com
Fri Feb 13 15:15:50 CET 2009
Hi Tim,
This is what i usually try and do (see ?file.copy)
## R Start...
> src.dir <- '\\\\PFO-SBS001\\Redirected\\tonyb\\Desktop\\folderA\\'
> dest.dir <- '\\\\PFO-SBS001\\Redirected\\tonyb\\Desktop\\folderB\\'
>
> file.names <- dir(src.dir)
> sapply(file.names, function(x) {
+ file.copy(from=paste(src.dir, x, sep=''),
+ to=paste(dest.dir, x, sep=''),
+ overwrite = FALSE) })
example.txt
TRUE
>
## R end.
Hope that helps a like,
Tony
On 13 Feb, 12:42, Tim Smith <tim_smith_... at yahoo.com> wrote:
> Hi,
>
> I was trying to copy a directory from one location to another. Is there a command to do this (similar to the file.copy command)?
>
> thanks!
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list