Removing a directory that isn't empty

G

Gabriel Dragffy

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
 
B

Bil Kleb

Gabriel said:
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,
 
A

Alex Young

Gabriel said:
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.
 
A

Arul hari

Gabriel said:
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.
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top