[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Removing a directory that isn't empty

Gabriel Dragffy

10/22/2007 11:42:00 AM

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

3 Answers

Bil Kleb

10/22/2007 12:07:00 PM

0

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

Alex Young

10/22/2007 12:10:00 PM

0

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

Vellingiri Arul

10/22/2007 12:32:00 PM

0

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