I am using the following script to find the latest .jpg file among around 50.000 files:
$file = exec("ls -t /home/ftp/$account | grep .jpg$ -i | head -n 1");
The script works, but multiple "broken pipe" errors occur in the Apache error.log. The log file is around 100GB.
I am almost sure that the above listed script is the troublemaker. Therefore I would like to know a better way to do the same thing.
Distribution: Debian (lenny).
Thanks in advance, Rasmus