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]]
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.
On Fri, 13 Feb 2009, Tim Smith wrote:> 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)?file.copy() does this in the development version of R. Most people use system(paste("cp -r", from, to)) in earlier versions (needs a Unix-alike or Rtools).> [[alternative HTML version deleted]] > > ______________________________________________ > 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. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Seemingly Similar Threads
- How to Run R Programs in a Scheduled Way
- problems with download.file() from ftp?
- changing 'https' to 'http' when using download.file(), any side effects or just use RCurl?
- RCurl unable to download a particular web page -- what is so special about this web page?
- Question on folder sync with "directory name translation"