Jump to content

Archived

This topic is now archived and is closed to further replies.

Jim from Oakland

delete files more than 24 hours old, in a directory

Recommended Posts

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

Share this post


Link to post
Share on other sites
This should do it:

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.