ruby 删除文件夹,包括文件夹中的文件夹和文件

def deleteDirectory(dirPath)
  if File.directory?(dirPath)
    puts "是文件夹";
        Dir.foreach(dirPath) do |subFile|
          if subFile != '.' and subFile != '..' 
            deleteDirectory(File.join(dirPath, subFile));
          end
        end
        Dir.rmdir(dirPath);
  else
        File.delete(dirPath);
  end
end
puts "删除完毕"
deleteDirectory(File.join(Dir.getwd, 'uexBrokenLine'));