[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How to delete a directory?

Daniel Carrera

10/26/2003 11:15:00 AM

Hi all,

I've read through the Pickaxe documentation, and the output from 'ri'. I
want to delete a directory, but I honestly can't figure out how. The File
class doesn't seem to have a method for this.

Any ideas?

Cheers,
--
Daniel Carrera | OpenPGP KeyID: 9AF77A88
PhD grad student. |
Mathematics Dept. | "To understand recursion, you must first
UMD, College Park | understand recursion".

1 Answer

E F van de Laar

10/26/2003 11:22:00 AM

0

* Daniel Carrera (dcarrera@math.umd.edu) wrote:
> Hi all,
>
> I've read through the Pickaxe documentation, and the output from 'ri'. I
> want to delete a directory, but I honestly can't figure out how. The File
> class doesn't seem to have a method for this.

emiel@marvin:/usr/lib/ruby/1.8> ri Dir.delete
------------------------------------------------------------ Dir::delete
Dir.delete( aString ) -> 0
------------------------------------------------------------------------
Deletes the named directory. Raises a subclass of SystemCallError
if the directory isn't empty.

If you are using Ruby 1.8 you should check out 'FileUtils'. It allows
you to do recursive deletes among other things.

Emiel
--
E F van de Laar
www.il.fontys.nl/~emiel