How to delete a folder in Ruby

To delete a folder in Ruby you can use the following snippet.

Sample Ruby

import os 
os.rmdir(ourdir) #use with an empty dir

import shutil 
shutil.rmtree(ourdir) #use with a non empty dir

Please Share us:
Please rate this snippet

One thought on “How to delete a folder in Ruby

Leave a Reply