[R] Remove
Thomas Lumley
tlumley at u.washington.edu
Wed Mar 7 18:03:19 CET 2001
On Wed, 7 Mar 2001, Emmanuel Paradis wrote:
> At 13:49 07/03/01 +0100, Alvaro Colina Santamaria wrote:
> >Stephanie Langevin wrote:
> >
> >> Hello,
> >>
> >> I would like to remove some files which have the extension .test for
> >> example (data1.test, data2.test ....).
> >> Is there another solution to remove them instead of doing it one by one
> >> ?
> >>
> >> Thanks for your help,
> >> Stéphanie Langevin
> >>
> >>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> -.-
> >> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> >> Send "info", "help", or "[un]subscribe"
> >> (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
> >>
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
> _._
> >
> >You can use:
> >
> >rm(list=objects(pattern=".test"))
>
> I understood that Stéphanie wanted to remove files on her system, not R
> objects from R's workspace. Thus I suggested:
>
> system("rm *.test")
>
> (assuming a Unix/Linux OS)
There's no need to make OS assumptions
unlink(list.files(pattern="\\.test"))
will delete files whose names contain .test (the pattern is a regular
expression -- I can't remember offhand how to specify that it ends in
.test)
-thomas
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list