$directoryArray[pathinfo($relativePath, PATHINFO_BASENAME)] = array(
to
preg_match('/\/([^\/]*)$/', $relativePath, $matches);
$pathname = isset($matches[1]) ? $matches[1] : $relativePath;
$directoryArray[$pathname] = array(with no successcan you help me?thanks in advance