in my bash script I create directory each month for backup as the follwoing:
DAY=$(date -d "$D" '+%d')
MONTH=$(date -d "$D" '+%m')
YEAR=$(date -d "$D" '+%Y')
mkdir -p /var/app/backup/$DAY$MONTH$YEAR
for example I get
01012000
01022000
01032000
.
.
.
01012014
01022014
01032014
01042014
.
.
.
.
after years , we want to remove the directories that old then half year
for example - the directories from 01012000 until 01062000 should be removed at 1/1/2015
what is the best approach ( from bash script ) in order to remove the directories that old then half year regarding that we have the date in the directory name
Aucun commentaire:
Enregistrer un commentaire