#!/bin/bash BASE_DIR="/home/avezina/test/bkp/" # Keep 2 directories DIR_TO_REMOVE=`ls -C1 -t $BASE_DIR | awk 'NR>2'` for DIR in $DIR_TO_REMOVE do rm -Rf $BASE_DIR/$DIR done
Malheureusement je n’ai pas trouvé comment mettre une variable pour le 2. Mais bon ce n’est pas trop simple à changer.
Comments
Leave a comment Trackback