I have a page that executes a script for each file in a directory:
$dir = new DirectoryIterator('/var/www/OCR3/upload_pending/');
foreach ($dir as $fileinfo) {
exec("php manual_doc_proccessor.php $fileinfo");
echo "php manual_doc_proccessor.php $fileinfo" . " Sent for proccessing <BR>";
}
Going to this script:
$fileinfo = $argv[1];
if (!$fileinfo->isDot()) {
print_r($fileinfo->getFilename()) . PHP_EOL ;
$fileName = $fileinfo->getFilename();
echo $fileName;
}
However, when the script is executed, I get an error:
Calling a member function isDot () for a non-object
I expect that each iteration of the script will be an echo of the file name, but instead I will get an error.
What am I missing and how can I get this to process files correctly?
source
share