Date scripting

Jacques B. jjrboucher at gmail.com
Fri Mar 24 09:26:38 UTC 2006


On 3/23/06, Tom Spec <samag70-ignore at yahoo.ca> wrote:
> > $FIND $BASEDIR -mtime +$DAYSTOKEEP -exec $COMMAND {}
> > \;
>
> FYI, the $FIND thing is all one line (it is the last
> line.)  I think my mail client wrapped it.
>
> Tom
>
>
> --
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>

Now that's much more efficient than what I was planning on doing.  And
if you wanted to run this across a number of directories you could use
a for loop such as:

for directory in $BASEPATH ; do
$FIND $BASEDIR -mtime +$DAYSTOKEEP -exec $COMMAND {} \;
done

Where your variable BASEPATH would contain a list of directories such as:
BASEPATH="/home/james/ /home/steve/ /home/mary/"

And of course add the recursive switch (-r or -R, either works) to the
rm command (so COMMAND="rm -rf" if you wanted it to be applied to all
subdirectories below the target directory.

Jacques B




More information about the fedora-list mailing list