文件夹的格式:
例如 20071201-10 20071211-20 20071221-31
20080101-10 20080111-20 20080121-31
注:以下SHELL脚本删除以上指定的文件夹
#!/bin/bash
#==================================
#
#Author: accepting
#
#Email: accepting@126.com
#
#Data: 2008.02.02
#
#Http://accepting.sharera.com
#
DOWNLOADS="/home/medialib/download"
#==================================
#
if [ $# -eq 0 ] ; then
CurYear=`date +%Y`
CurMonth=`date +%m`
CurDay=`date +%d`
GetYear="$CurYear"
GetMonth="`expr $CurMonth`"
GetDay="`expr $CurDay - 1`"
if [ "$GetDay" -eq 10 ] ; then
rm -rf "$DOWNLOADS$GetYear$GetMonth"01-10
echo "$GetYear$GetMonth"01-10
elif [ "$GetDay" -eq 20 ] ; then
rm -rf "$DOWNLOADS$GetYear$GetMonth"11-20
echo "$GetYear$GetMonth"11-20
elif [ "$GetDay" -le 0 ] ; then
GetMonth="`expr $CurMonth - 1`"
if [ "$GetMonth" -le 0 ] ; then
GetYear=`expr $CurYear - 1`
GetMonth=12
fi
if [ `echo "$GetMonth" | wc -m` -ne 3 ] ; then
GetMonth=0$GetMonth
fi
rm -rf "$DOWNLOADS$GetYear$GetMonth"21-30
echo "$GetYear$GetMonth"21-31
else
echo --==该文件夹不存在!!!!==--
fi
fi