require 'fileutils'
target_folder = 'some_path/delete_me'
FileUtils.rm_rf(target_folder)
# if you want to keep target_folder, but delete all folders underneath.
FileUtils.rm_rf(Dir.glob("#{target_folder}/*"))
# if you want to only delete empty folders recursively.
Dir.glob("#{target_root_path}/**/")
.reverse_each { |d| Dir.rmdir d if Dir.entries(d).size == 2 }