How to delete a directory?

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”.

emiel@marvin:/usr/lib/ruby/1.8> ri Dir.delete
------------------------------------------------------------ Dir::delete
Dir.delete( aString ) → 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.


 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