I am trying to delete photos from /plugin/webcam/ folder older than x days.
This script is doing that.
But what I am wondering if there is a way of getting the script to delete the thumbnails as well in the subfolder
here is the script I found online
<?php
/** define the directory **/
$dir = "images/";
/*** cycle through all files in the directory ***/
foreach (glob($dir."*.jpg") as $file) {
/*** if file is 24 hours (259200 seconds) old then delete it ***/
if(time() - filectime($file) > 259200){
unlink($file);
thanks in advance
delete photos php script
- Fraggboy
- Forecaster
- Posts: 193
- Joined: Wed Sep 27, 2017 2:45 pm
- Location: Sunny California
- Station model: Bloomsky II + Storm
- Software: Bloomsky
- Contact:
Re: delete photos php script
I just execute 1 script for 3 different locations in a cron job (I execute the script every 7 days). This script removes all files that is older than 5 days.
I'm using this for my Bloomsky image, video and thumbnail folders (Different application, but should work for the webcam folder)
Code: Select all
find /www/template/plugins/bloomSky/images* -mtime +5 -exec rm {} \;
find /www/template/plugins/bloomSky/images/thumbnails* -mtime +5 -exec rm {} \;
find /www/template/plugins/bloomSky/videos* -mtime +5 -exec rm {} \;