Removing all the sub dierectories and files

i need ruby code to remove all the sub dierectories and files, but main folder should not delete

You need to look at the Dir class: class Dir - RDoc Documentation
or perhaps the File class: class File - RDoc Documentation

These classes contain methods to list and delete directories and files.