How to delete a directory?

D

Daniel Carrera

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,
 
E

E F van de Laar

* Daniel Carrera ([email protected]) said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,138
Messages
2,570,804
Members
47,349
Latest member
jojonoy597

Latest Threads

Top