Removing only child directories

i want to delete only child dierectoris, but i am getting a code its deleting parent directory also

I think you are looking for Dir.children