I have Motion Eye CCTV running on Raspian.
The output is all stored in various sub folders under a Motioneye folder. One folder per camera and beneath that, one folder per day.
What's the best way to do some script to check the size of these folders and if over a certain size, delete some files ?
Doing it purely by age of file isn't reliable, as the number of files per day depends heavily on what goes on in front of the Cameras. I had over 2 Gb of files yesterday, when working in front of the house for just over an hour. Only 100 Mb the day before.
1 The basic Motioneye software allows me to set it to delete files over a certain age. I'd prefer to set this at about 10 days, just so I can check back if there is any problem when away from home.
2 If the total size for all the subdirectories is over (say) 4 GB, I'd like to delete the oldest files.
3 If the total size of any one directory exceeds (say) 2 GB, I'd probably need to delete some files from that directory. This is probably the critical part.
This all syncs to pcloud and I have a 6 GB limit there at present, which I need to stay below.
I'm not even sure what language to use for this.
The output is all stored in various sub folders under a Motioneye folder. One folder per camera and beneath that, one folder per day.
What's the best way to do some script to check the size of these folders and if over a certain size, delete some files ?
Doing it purely by age of file isn't reliable, as the number of files per day depends heavily on what goes on in front of the Cameras. I had over 2 Gb of files yesterday, when working in front of the house for just over an hour. Only 100 Mb the day before.
1 The basic Motioneye software allows me to set it to delete files over a certain age. I'd prefer to set this at about 10 days, just so I can check back if there is any problem when away from home.
2 If the total size for all the subdirectories is over (say) 4 GB, I'd like to delete the oldest files.
3 If the total size of any one directory exceeds (say) 2 GB, I'd probably need to delete some files from that directory. This is probably the critical part.
This all syncs to pcloud and I have a 6 GB limit there at present, which I need to stay below.
I'm not even sure what language to use for this.
Statistics: Posted by jaizan — Tue Aug 19, 2025 5:10 pm