Re: [R] deleting a directory

From: Sundar Dorai-Raj <sundar.dorai-raj_at_pdf.com>
Date: Wed 02 Aug 2006 - 01:59:38 EST

Please ignore. I forgot ?unlink had a recursive argument.

Thanks.

--sundar

Sundar Dorai-Raj wrote:
> Hi, all,
>
> I'm looking a utility for removing a directory from within R. Currently,
> I'm using:
>
> foo <- function(...) {
> mydir <- tempdir()
> dir.create(mydir, showWarnings = FALSE, recursive = TRUE)
> on.exit(system(sprintf("rm -rf %s", mydir)))
> ## do some stuff in "mydir"
> invisible()
> }
>
> However, this is assumes "rm" is available. I know of ?dir.create, but
> there is no opposite. And ?file.remove appears to work only on files and
> not directories.
>
> Any advice? Or is my current approach the only solution?
>
> > R.version
> _
> platform i386-pc-mingw32
> arch i386
> os mingw32
> system i386, mingw32
> status
> major 2
> minor 3.1
> year 2006
> month 06
> day 01
> svn rev 38247
> language R
> version.string Version 2.3.1 (2006-06-01)
>
>
> Thanks,
>
> --sundar
>
>



R-help@stat.math.ethz.ch 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. Received on Thu Aug 03 20:15:09 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 03 Aug 2006 - 22:17:29 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.