[R] delete content of directory - unlink doesn't work as expected

Hans-Peter gchappi at gmail.com
Tue Nov 28 16:28:27 CET 2006


> > invisible(lapply( list.files( "DeleteThis" ), function(x)
> > file.remove(paste("DeleteThis", x, sep="/" )) ))
>
> Oh, dear!  file.path() exists for a reason, and file.remove is
> vectorized.  Try
> file.remove(dir("DeleteThis", full.names=TRUE))

argh, very embarassing to have asked this...

;-(



More information about the R-help mailing list