Jump to content

Time based delete


Dudditz

Recommended Posts

Noob question: I was wondering if its possible for a php file to delete itself?

 

I often upload temporary files for others to view which I do not want to remain in my webspace but for a short time.

If there is no script to delete itself, does anyone know of a snippet or something to delete based on a time() variable inside the targeted file?

 

Example:

the_deleter.php scans the first line of each file in a directory where a time() variable is placed.

It then checks that variable against a deletion time and determines either to delete the file or pass to the next file.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/94398-time-based-delete/
Share on other sites

use cron to auto delete based on time

 

I would but wanted each file with a different deletion time.

file one - delete time 3AM

file two - delete time 1PM

file three - delete time - Dec 31,2010

 

I am attempting to write something using the unlink() currently but the time function is really messing me up.

Just thought there may be an easier approach.

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/94398-time-based-delete/#findComment-483490
Share on other sites

Archived

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

×
×
  • Create New...

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.