I am in need for a script which will automatically delete old releases from a dir (and its' subdirs) when this dir (including its' subdirs) reach a specific size.
For example:
let's say I have the following dirs:
DIR1
--SUBDIR1
----CD1
----CD2
--SUBDIR2
--SUBDIR3
and I want that the total size of DIR1 (including all the other subdirs, and CD1/CD2) not exceed 10g.
I need a script which will check all the subdirs below DIR1 for the oldest release and delete it to free enough space so the total size will never exceed 10g.
Thanks in advance for any assistance!