I need a script that will delete files in a specified folder. <?php function delfile($str) { foreach(glob($str) as $fn) { unlink("temp/$fn"); } ?> PHP: doesnt seem to work...is it possible for the same script to delete files after x days?
looks like unlink should work. What happens when you try? Is the script in the same directory as the file? Some ref: http://us.php.net/delete Yes, it is possible to delete a file after xx days. I think the best way would be to write a script that compare todays date to the created or modified date of the file. You could then run this manually or via cron, etc... I am not sure of the exact code, but PHP can handle it.