[R] How to copy files emulating "cp -f" on Unix

Tang, Hsiu-Khuern hsiu-khuern_tang at intuit.com
Wed Jun 27 06:30:42 CEST 2012


Hi,

Is there a function that emulates cp -f on Unix, in that existing but non-writable destination files are removed first?

I thought file.copy(src, dst, overwrite = TRUE) did that, but it doesn't: it will not copy to non-writable dst.  To be sure, this behavior is consistent with the documentation.

I could do a (conditional) file.remove(dst) first -- just wanted to know if there is a more direct way.

-- 
Best,
Hsiu-Khuern.



More information about the R-help mailing list