Dear R-users, I have a problem: I have many files in the directory:"C:/Documents and Settings/lma/Desktop/FamilyAEntrepreneurs/Entrepreneurs/Juha" I want to copy those files into the new directory: "C:/Documents and Settings/lma/My Documents/Juha/book" (<-use "paste"), I first create the directory using dir.create, but it looks doesnt work. How do I implement this copy operations in R? Thanks for help Tammy _________________________________________________________________ Show them the way! Add maps and directions to your party invites. http://www.microsoft.com/windows/windowslive/products/events.aspx [[alternative HTML version deleted]]
On Sep 22, 2009, at 4:59 AM, Tammy Ma wrote:> > Dear R-users, > > I have a problem: > > I have many files in the directory:"C:/Documents and Settings/lma/ > Desktop/FamilyAEntrepreneurs/Entrepreneurs/Juha" > > I want to copy those files into the new directory: "C:/Documents and > Settings/lma/My Documents/Juha/book" (<-use "paste"),Why would you not use your operating system for such a task? (There is no cut paste paradigm in R.)> I first create the directory using dir.create, but it looks doesnt > work.Explain what "does not work actually means": Code used? Error messages?> > How do I implement this copy operations in R? > > Thanks for help > > Tammy >David Winsemius, MD Heritage Laboratories West Hartford, CT
Try this: sourceDir <- "C:\\temp\\" destDir <- "C:\\new\\new" if(is.na(file.info(destDir)$isdir)) dir.create(destDir, recursive = TRUE) file.copy(dir(sourceDir, full.names = TRUE), destDir) On Tue, Sep 22, 2009 at 5:59 AM, Tammy Ma <metal_licaling at live.com> wrote:> > Dear R-users, > > I have a problem: > > I have many files in the directory:"C:/Documents and Settings/lma/Desktop/FamilyAEntrepreneurs/Entrepreneurs/Juha" > > I want to copy those files into the new directory: "C:/Documents and Settings/lma/My Documents/Juha/book" (<-use "paste"), I first create the directory using dir.create, but it looks doesnt work. > > How do I implement this copy operations in R? > > Thanks for help > > Tammy > > _________________________________________________________________ > Show them the way! Add maps and directions to your party invites. > http://www.microsoft.com/windows/windowslive/products/events.aspx > ? ? ? ?[[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. >-- Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O