[EMAIL PROTECTED] wrote:
> ----- Original Message ----- 
> From: "Wade Smart"
> 
> I tried moving all the files and the script into the same folder and I
> still have the same problem.
> 
> Wade
> ------------------------------
> Hello Wade,
>                    You didn't answer my previous questions, they must not 
> seem important to you.
> 
> File permission's is an issue that stumps a lot of scripts, even 
> professionally made scripts when they are shifted from server to server.
> 
> There are 3 mainstreem operating systems and these three have two different 
> types of file system. On top of that there are two mainstream http servers 
> and php can exist on these two server types in two completely different 
> forms. In one of these forms there are further variations on how files are 
> handled. And on top of that again is php config and htacess and httpconfig 
> directives.
> 
> It is all too much to explain in one email.
> 
> I suggest you sort out the permission problem first but I doubt it is the 
> issue. It is just that it easier to sort out.
> 
> Change the permission's of the script and files and ALSO the directories 
> they are in to 777 and test it. Don't leave them as 777 for any longer than 
> necessary.
> 
> If it then works you have a permission's problem and you need to answer some 
> questions before we can help you.
> 
> If it still doesn't work then post the full script rather than having to 
> answer an ongoing series of questions.
> 
> Thanks, Rob. 
> 

01172008 2017 GMT-6

I didnt respond to the permissions as I had already previously indicated 
, but perhaps it was unclear, their setting.

Files/ folder is 1600774
Files within the folder are 600664.

I changed the folder to 1600777 and the files to 600666 but still 
received the same result as last posted. The script itself is 600666.

The full script is a follows:
<?php
// count how many files are in the folder
// for each name
// add 01, 02, 03 in front of each one.
        
ini_set('display_errors', 1);
error_reporting(E_ALL);

function get_file_count($dir){
        while ($file_name = readdir($dir)){
                $count = 0;
                if (($file_name != ".") && ($file_name != "..") ){
                        if (eregi("~", $file_name) || eregi(".php", $file_name) 
) {
                         } else {
                                $file_count[] = $file_name;
                                $count = $count + 1;
                        }
                }
        }
        return $file_count;
}       
        
        // variables
        $count = 0;

        $dirName = "Files/";
        $dir = opendir($dirName);
        $file_count = array();  
        
        // How many files?
        $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){
           while($count >0){
              rename($dirName.$newfile, $dirName.$count."_".$newfile);          
                $count--;
        
                }
        }
?>


Wade

Reply via email to