I added a few slashes and did this:
$dir= getcwd().'/cache_chaindlk';//set to full server path
$seconds= 24 * 60 * 60;
$files= scandir($dir);
foreach($files as $num=>$fname){
if(file_exists($dir.'/'.$fname) && ((time() - filemtime($dir.'/'.$fname)) > $seconds)){
unlink($dir.'/'.$fname);
echo 'Deleting '.($dir.'/'.$fname).'...<br />';
}
}
Seems to be working, if it doesn't I'll report back in half hour when it's goes through all 5000 cache files...
Thanks for your help!