[R] Create directory and copy files in R

milton ruser
Tue, 22 Sep 2009 17:37:16 -0000

Tammy

Try avoid directories with spaces... may be this solve your problem.
Case not, write us again.

bests
milton

On Mon, Sep 21, 2009 at 10:05 AM, Tammy Ma <metal_licaling@live.com>
wrote:

>
>
> HI, All R users,
>
> My problem is:
>
> > fn
> [1] "C:/Documents and
>
Settings/lma/Desktop/FamilyAEntrepreneurs/Entrepreneurs/Juha/book_log-20041210T095019.txt"
> > dpath
> [1] "C:/Documents and Settings/lma/My Documents/Juha/book"
>
>
> I want to make  a function "cyfun" to copy all files in
"dir" to "deskdir"
> but I always got the following problem:
>
> Error in file.exists(to) : invalid 'file' argument.
> Whats the problem??
>
>
>
>
> cyfun<-function(fn,dpath){
> dir<-dirname(fn)
> fn<-basename(fn)
>
> deskdir<-dir.create(dpath)
> file.copy(fn, deskfile)
>
> }
>
> Thanks!
>
> Tammy
>
> _________________________________________________________________
> Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.
>
> http://www.microsoft.com/windows/windowslive/products/photos.aspx
>        [[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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
>

	[[alternative HTML version deleted]]