Hi, I have this very strange problem which is pulling out my hair.
I want to rename a file in 3 or 4 level folder
The code is simple:
<?php
$oldthumb1path = "../TEST/Pics/TSTXX/TSTXX-Portulaca_nigra_t.jpg";
$newthumb1path = "../TEST/Pics/TSTXZ/TSTXZ-Portulaca_nigrescens_t.jpg";
print "<br><br> Renaming $oldthumb1path to $newthumb1path ...";
if (rename ($oldthumb1path , $newthumb1path)) {print "<font color=green> Success! </font>";} else { print "<font color=red> Rename failed.</font>";}
?>
The result is that the renaming fails with a wrong error message:
Warning: rename(…\TEST\Pics\TSTXX\TSTXX-Portulaca_nigra_t.jpg,…\TEST\Pics\TSTXZ\TSTXZ-Portulaca_nigrescens_t.jpg): No such file or directory in E:\WEBSITE…
The php file is in a php folder common with folder TEst (hence the …/) The strange thing of them all is that if I place the php script in the folder were the file is present (hence in folder TSTXX) the renaming takes place successfully. I really need a tip to solve this since I been programming a long script to rename my web image files (10,000s) automatically, and I am not in the mood to rename them manually.
What’s wrong ? 100% sure that there is no typo in the filenames, and the destination file does not exist.