Results 1 to 1 of 1
08-11-2009, 12:48 PM #1
- Join Date
- Aug 2009
make sure file is written to and closed before renaming
This is all on XP. I am using CLI php to loop through a folder converting all .ppts to pdfs.
I use pdfcreator.exe for this. the relevant php line is:
$convertproc = proc_open('"C:\Program Files\PDFCreator\PDFCreator.exe" /NoStart /PF'.$file, $descriptorspec, $retval);
(I've also used exec() in earlier efforts).
I then get the process id using
and pause until the process is finished, then close the process:
$procstatus = proc_get_status($convertproc);
Then I try to rename the file:
$output = exec('ren '.$newfile .' '. $finalname, $output, $returnval);
However, the new pdf file seems to get written to *after* the process has finished running, so the rename fails. I've tried filesize(), is_readable(file) and all sorts of others but to no avail.