src/Migrator.php
public function getRecursiveFolders($folders)
    {
        if (! is_array($folders)) {
            $folders = [$folders];
        }

        $paths = [];

        foreach ($folders as $folder) {
            $iter = new Iterator(
                new DirectoryIterator($folder, DirectoryIterator::SKIP_DOTS),
                Iterator::SELF_FIRST,
                Iterator::CATCH_GET_CHILD // Ignore "Permission denied"
            );

            $subPaths = [$folder];
            foreach ($iter as $path => $dir) {
                if ($dir->isDir()) {
                    $subPaths[] = $path;
                }
            }

            $paths = array_merge($paths, $subPaths);
        }

        return $paths;
    }
public function getRecursiveFolders($folders)
    {
        if (! is_array($folders)) {
            $folders = [$folders];
        }

        $paths = [];

        foreach ($folders as $folder) {
            $iter = new Iterator(
                new DirectoryIterator($folder, DirectoryIterator::SKIP_DOTS),
                Iterator::SELF_FIRST,
                Iterator::CATCH_GET_CHILD // Ignore "Permission denied"
            );

            $subPaths = [$folder];
            foreach ($iter as $path => $dir) {
                if ($dir->isDir()) {
                    $subPaths[] = $path;
                }
            }

            $paths = array_merge($paths, $subPaths);
        }

        return $paths;
    }
public function getRecursiveFolders ( $ folders ) { if ( ! is_array ( $ folders ) ) { $ folders = [ $ folders ] ; } $ paths = [ ] ; foreach ( $ folders as $ folder ) { $ iter = new Iterator ( new DirectoryIterator ( $ folder , DirectoryIterator :: SKIP_DOTS ) , Iterator :: SELF_FIRST , Iterator :: CATCH_GET_CHILD // Ignore "Permission denied" ) ; $ subPaths = [ $ folder ] ; foreach ( $ iter as $ path => $ dir ) { if ( $ dir -> isDir ( ) ) { $ subPaths [ ] = $ path ; } } $ paths = array_merge ( $ paths , $ subPaths ) ; } return $ paths ; }
Get all subdirectories located in an array of folders.

@param array $folders

@return array
Get all subdirectories located in an array of folders .