[R] Manipulate directory-help

Henrique Dallazuanna wwwhsd at gmail.com
Tue Sep 22 15:10:15 CEST 2009


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




More information about the R-help mailing list