Wade Smart wrote:
> James Keeline wrote:
>> --- Wade Smart <[EMAIL PROTECTED]> wrote:
>>
>>>> The potential problem is the $dirName.$newfile because $dirName is not a 
>>>> full path. This will crash when there are symlinks.
>>>>
>>>> Hope that helps, Rob. 
>>> Thanks Rob. That worked.
>>>
>>> Question. From my original code you can see I scan the directory, post 
>>> how many files are in the directory and their names. Next I rename them. 
>>> All that is working. What I want to do now is run another scan on the 
>>> directory posting the "new" file names. Im just reusing the same code 
>>> from above. However, its not putting out any names.
>>>
>>> Is there a problem of, because this is sequential that once the names 
>>> are changed php cant get another reading on the file names?
>>>
>>> Wade
>> Some filesystem actions in PHP involve some caching.  PHP has a function 
>> which
>> may have application here:
>>
>> http://us.php.net/manual/en/function.clearstatcache.php
>>
>> James
>>
> 01182008 1556 GMT-6
> 
> Still no results. It will count again but not the new names.
> 
> Wade

01182008 1609 GMT-6

Im calling the clearstatcache() right after the last initial set of 
renaming.

Wade

$file_count = get_file_count($dir);
                $count = count($file_count);
                echo "<br />How many files? : $count<br />";    
                
                
                foreach($file_count as $file){
                        echo $file."<br />";
                }
                
                foreach($file_count as $newfile){
                                rename($dirName.$newfile, 
$dirName.$count."_".$newfile);                
                                $count--;
                }
                
                clearstatcache();
                
                $file_count2 = get_file_count($dir);
                $count2 = 0;
                $count2 = count($file_count);
                echo "<br />How many files? : $count2<br />";   
                
                
                foreach($file_count2 as $file2){
                        echo $file2."<br />";
                }

Reply via email to