#!/bin/bash

WHAT=you_path_here
DIR="private etc sysvol"

WHERE=/usr/local/backups
WHEN=`date +%d%m%y`

cd $WHAT
for d in $DIR;do
n=`echo $d | sed 's/\//_/g'`
tar cjf ${WHERE}/${n}.${WHEN}.tar.bz2 $d>/dev/null 2>&1
done

find $WHERE -name "*bz2" -mtime +90 -exec rm  {} \;
