You are here

function fancy_file_delete_unmanaged_get_sub_directories in Fancy File Delete 7

Answer an array of directory paths and URI's.

Parameters

string $dir The file-system path of the directory.:

string $uri_prefix The prefix, e.g. 'public://' or 'private://':

optional array $exclude_paths File-system paths to exclude from the results.:

Return value

array

1 call to fancy_file_delete_unmanaged_get_sub_directories()
fancy_file_delete_unmanaged_get_directories in ./fancy_file_delete.module
Answer a list of directories to include/exclude.

File

./fancy_file_delete.module, line 322

Code

function fancy_file_delete_unmanaged_get_sub_directories($dir, $uri_prefix, array $exclude_paths = array()) {
  $results = array();
  $iterator = new RecursiveIteratorIterator(new FancyFileDeleteDirectoryOnlyRecursiveFilterIterator(new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS), $exclude_paths), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD);

  // Go through each one and add a proper uri.
  foreach ($iterator as $file) {
    $results[] = str_replace($dir . '/', $uri_prefix, $file
      ->getPathname());
  }
  return $results;
}