code: static public function generateDir($directory, $length = 8)
      {
          do {
              $name = \Extlib\Generator::generate($length);
              $filepath = rtrim($directory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name;
          } while (is_dir($filepath));
  
          return $name;
      }
docs: Generate directory
  
  @param $directory
  @param int $length
  @return string