Removing a directory that isn't empty

What would be the best way to use Dir.rmdir to delete a directory that isn't empty? I think it would involve performing a recursive delete, this is trivial in bash, but what about in Ruby?

Many thanks

Gabriel Dragffy

Gabriel Dragffy wrote:

What would be the best way to use Dir.rmdir to delete a directory that isn't empty? I think it would involve performing a recursive delete, this is trivial in bash, but what about in Ruby?

I normally use FileUtils for that sort of thing, e.g.,

  require 'fileutils'
  FileUtils.rm_rf 'directory'

Regards,

···

--
Bil Kleb
http://nasarb.rubyforge.org

Gabriel Dragffy wrote:

What would be the best way to use Dir.rmdir to delete a directory that isn't empty? I think it would involve performing a recursive delete, this is trivial in bash, but what about in Ruby?

FileUtils.rm_rf should do the trick.

···

--
Alex

Gabriel Dragffy wrote:

What would be the best way to use Dir.rmdir to delete a directory
that isn't empty? I think it would involve performing a recursive
delete, this is trivial in bash, but what about in Ruby?

Many thanks

Gabriel Dragffy

Dear Friends,
        I am having one best idea to removing the empty directory.
You have to remove the directory while checking the directory size.
and also while putting the du -sh itself we can do .It is a easy method
to remove the directory.
Somebody might have asking the question before itself.
Plese you could go and see all the questions.In somewhere you will get
the idea for this.

by
vellingiri.

···

--
Posted via http://www.ruby-forum.com/\.