I have issue while using glob function when path directory with square brackets.
// Example 1 - working $path = \'temp\'. DIRECTORY_SEPARATOR .\'dir - name\'
Try
$path = 'temp'. DIRECTORY_SEPARATOR .'dir - [name]'; $from = array('[',']'); $to = array('\[','\]'); $files =glob(str_replace($from,$to,$path . "\\*.txt")); echo ''; print_r($files); echo '';
'; print_r($files); echo '