#!/bin/bash for filename in /mnt/drive2/serverbackup/*seedcampus*; do file_date=`date -r $filename` if [ `date -d "$file_date +1day" +%d` != "01" ] &&[ `date -d "$file_date" +%m` != "02" ] ;then rm -f "$filename" fi done
#!/bin/bash for filename in /mnt/drive2/serverbackup/*seedcampus*; do file_date=`date -r $filename` if [ `date -d "$file_date +1day" +%d` != "01" ] &&[ `date -d "$file_date" +%m` != "02" ] ;then rm -f "$filename" fi done