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: https://docs.ruby-lang.org/en/2.7.0/Dir.html
or perhaps the File class: https://docs.ruby-lang.org/en/2.7.0/File.html

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs