[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Date scripting



On 3/23/06, Tom Spec <samag70-ignore 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 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]