original_string: public function listAllDirectories($exclude = [])
      {
          $fullPath = $this->getMediaPath('/');
  
          $folders = $this->getStorageDisk()->allDirectories($fullPath);
  
          $folders = array_unique($folders, SORT_LOCALE_STRING);
  
          $result = [];
  
          foreach ($folders as $folder) {
              $folder = $this->getMediaRelativePath($folder);
              if (!strlen($folder)) {
                  $folder = '/';
              }
  
              if (Str::startsWith($folder, $exclude)) {
                  continue;
              }
  
              $result[] = $folder;
          }
  
          if (!in_array('/', $result)) {
              array_unshift($result, '/');
          }
  
          return $result;
      }
code: public function listAllDirectories($exclude = [])
      {
          $fullPath = $this->getMediaPath('/');
  
          $folders = $this->getStorageDisk()->allDirectories($fullPath);
  
          $folders = array_unique($folders, SORT_LOCALE_STRING);
  
          $result = [];
  
          foreach ($folders as $folder) {
              $folder = $this->getMediaRelativePath($folder);
              if (!strlen($folder)) {
                  $folder = '/';
              }
  
              if (Str::startsWith($folder, $exclude)) {
                  continue;
              }
  
              $result[] = $folder;
          }
  
          if (!in_array('/', $result)) {
              array_unshift($result, '/');
          }
  
          return $result;
      }
code_tokens: public function listAllDirectories ( $ exclude = [ ] ) { $ fullPath = $ this -> getMediaPath ( '/' ) ; $ folders = $ this -> getStorageDisk ( ) -> allDirectories ( $ fullPath ) ; $ folders = array_unique ( $ folders , SORT_LOCALE_STRING ) ; $ result = [ ] ; foreach ( $ folders as $ folder ) { $ folder = $ this -> getMediaRelativePath ( $ folder ) ; if ( ! strlen ( $ folder ) ) { $ folder = '/' ; } if ( Str :: startsWith ( $ folder , $ exclude ) ) { continue ; } $ result [ ] = $ folder ; } if ( ! in_array ( '/' , $ result ) ) { array_unshift ( $ result , '/' ) ; } return $ result ; }
docstring: Returns a list of all directories in the Library, optionally excluding some of them.
  @param array $exclude A list of folders to exclude from the result list.
  The folder paths should be specified relative to the Library root.
  @return array
docstring_tokens: Returns a list of all directories in the Library optionally excluding some of them .