SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: PHP Script Deletion
-
May 7, 2009, 20:02 #1
- Join Date
- Dec 2008
- Location
- Australia
- Posts
- 389
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
PHP Script Deletion
I want to set up a script which I can run at about 4PM every day on a cron, to delete folders.
I have a script which puts files into a folder according to date.
For example:
The date is 4th May, the folder name 04_05
The date is 5th May, the folder name 05_05
So on and so forth.
On the 5th May, I want a cron to run to delete the folder 04_05 and all files under it (as the folder the day before is no use now as todays folder has been created and everything runs through this.)
Basically, I just want a script which will run on day 2, and delete the day 1 folder.
Any help is very much appreciated.:-)
-
May 7, 2009, 20:09 #2
- Join Date
- Aug 2000
- Location
- Philadephia, PA
- Posts
- 20,578
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
PHP Code:exec("rm -rf /home/example/" . date("d_m", strtotime("yesterday")));
Try Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more
-
May 7, 2009, 20:38 #3
- Join Date
- Dec 2008
- Location
- Australia
- Posts
- 389
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yeah I've been using shell to delete the folders so far, the folders reach about 100GB of disk space per folder per day... getting too busy I need to start freeing up space daily using a cron.
Thanks for your help, I will have a go with this. Much appreciated.:-)
Bookmarks