What I want to do is to rename a particalar file that is ftp'd to the server into a certain folder which I will call "raw" and have that file renamed to "image.jpg" in the folder "webcam" but the file uploaded by the webcam is different every time because the webcam puts the time and date in the filename. So far I have worked out this:

<?php rename("/home/a6773990/public_html/webcam/raw/"'*',"/home/a6773990/public_html/webcam/webcam/image.jpg"); ?> [/CODE=PHP][CODE=PHP]

7 Years
Discussion Span
Last Post by phpstan

I'm not clear if you are wanting the most recent file, but you can read the directory (http://www.php.net/manual/en/function.readdir.php) to get the filenames. If you are looking for the filename with the highest sequence number, then you can store the filename if its greater than the stored filename.
If you are needing to look for the most recent file, then use the "stat" function (http://us2.php.net/manual/en/function.stat.php) on each file to get the timestamp and store the filename with the most recent timestamp.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.