Re: OT: Shell scripting wizardry needed


Subject: Re: OT: Shell scripting wizardry needed
From: Gawain (lists0501@guitar.net)
Date: Thu Dec 20 2001 - 11:11:31 MST


At 8:12 PM -0800 on 12/19/01, Paul J. Lucas wrote:

>On Wed, 19 Dec 2001, Gawain wrote:
>
>> To save on disk space I'd like the script to automagically delete
>> directories that are more than a specified number of days old.
>>
>> How can I do this?
>
> man find

In the interest of helping others who may have the same problem,
here's the command that finally did the trick:

# REMOVE FILES AND DIRECTORIES OLDER THAN A CERTAIN DATE (20 days in this case)
find /foo/bar -mtime +20 -maxdepth 1 -exec rm -rf '{}' ';'

Obviously, any command that deletes files has the potential to cause
tremendous damage to your system. Be careful! I did a lot of testing
before adding the line to my shell script.

Gawain



This archive was generated by hypermail 2a24 : Thu Dec 20 2001 - 11:24:59 MST