[mdlug] Script to delete old files?
David McMillan
skyefire at skyefire.org
Tue Mar 1 11:34:01 EST 2011
On 3/1/2011 8:52 AM, Carl T. Miller wrote:
> Stan Green wrote:
>> My thought is a script something like this (pseudo code):
>> df> FreeSpace
>> if FreeSpace is less then 25%
>> if FreeSpace is less then 50% do
>> delete the oldest file
>> df> FreeSpace
>> Loop until FreeSpace is greater then 50%
> This would work, although if you have a lot of files it
> might run for a long time. A way to speed it up would
> be to delete files older than X weeks/days/hours/minutes.
> If this runs every week, you could have it count down
> from 8 weeks to 1 week. The find command could be used
> to find and delete the files relatively quickly.
Or... since the files he wants to delete are already copied to a
remote machine, would it be practical to generate a list of files
duplicated in both locations using rsync or fslint, and delete the local
copies?
More information about the mdlug
mailing list