I want to rename picture filename (without extension) to old.jpg from this code.
I have picture file in parent directory and t
Like Seth and Jack mentioned, the error is appearing because the script cannot find the old file. You're making it look in the current directory and not it's parent.
To fix this, either enter the full path of the old file, or try this:
rename("../picture.jpg", "old.jpg");
The ../ traverses up a single directory, in this case, the parent directory. Using ../ works in windows as well, no need to use a backslash.
If you are still getting an error after making these changes, then you may want to post your directory structure so we can all look at it.