Strange Behaviour : unlink not deleting files in php
<p>Somehow unlink is not deleting the file. If you see in the file, am copying from $incoming_file_path to $processing_file_path and than after copying is done. I am trying to delete the file in $incoming_file_path but somehow is it not deleting and I really wonder why it is happening so. Kindly advice. </p>

<pre><code>&lt;?php
ini_set('error_reporting',0);
$file = fopen("pid.txt","w+") or die('!fopen');
flock($file, LOCK_EX);

//Folder where xml files will be coming in from UPC
$incoming_file_path = "/home/xmlcontainer";
$processing_file_path = "/home/process_file";
$threshold = time() - 30;
foreach( glob($incoming_file_path.'/*')as $key =&gt; $value ) {
  if ( filemtime($value) &lt;= $threshold ) {
    copy($incoming_file_path.$value,$processing_file_path.$value);
    print_r($incoming_file_path.$value."\n");
    unlink($incoming_file_path.$value);
    print_r($incoming_file_path.$value."\n");
    print_r($processing_file_path.$value."\n");
    }
}
flock($file,LOCK_UN);

?&gt;
</code></pre>

<p><hr></p>
