----- Original Message ----- 
From: "Wade Smart"

I need to rename several hundred files.
I first get the number of files in the folder and then count backwards:

foreach($file_count as $newfile){
while($count >0){
rename($newfile, $count.$newfile);
$count--;
}
}

I need to number then sequentially.
Right now I just have a test file that Im working on.
Im getting this result:


How many files? : 3
file_name_B
file_name_C
file_name_A

Warning: rename(file_name_B,3file_name_B) [function.rename]: No such
file or directory in
/var/www/public/Misc/Rewrite_File_Name/rewrite_file_name_01.php on line 46

Warning: rename(file_name_B,2file_name_B) [function.rename]: No such
file or directory in
/var/www/public/Misc/Rewrite_File_Name/rewrite_file_name_01.php on line 46

Warning: rename(file_name_B,1file_name_B) [function.rename]: No such
file or directory in
/var/www/public/Misc/Rewrite_File_Name/rewrite_file_name_01.php on line 46

I have www_data as owner and group so it can read and write.

Wade
--------------------------------

Hello Wade,
                  The error message is 'No such file' so I don't think it is 
a permission's problem.

Are the original file names hard coded or are you using a Directory scan?

Perhaps there is a symlink in the path to where your script is? Try 
realpath() with the full server side path.

Hope this helps.

Reply via email to