Re: Date scripting

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

 



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

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux