Jump to content


Photo

delete files more than 24 hours old, in a directory


  • Please log in to reply
1 reply to this topic

#1 Jim from Oakland

Jim from Oakland
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 11 October 2006 - 06:09 PM

Phreax

This must be a common task.  I need delete files that are more than 24 hours old from a specific directory (no subdirectories).

Thanks very much for your assistance.

Jim


#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 11 October 2006 - 06:18 PM

This should do it:

if(filemtime($file)+24*3600 > time())
{
	unlink($file);
}





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users