运用bash删除n天前的文件

使用bash删除n天前的文件#/bin/env bash## This script will remove the files created nDays days ago#nD

使用bash删除n天前的文件

#/bin/env bash## This script will remove the files created nDays days ago#nDays=30TARGET_PATH="/path/to/archive1:/path/to/archive2"SaveIFS=$IFSIFS=":"declare -a Array=($TARGET_PATH)IFS=$SaveIFSecho "`date` Arr Length="  ${#Array[@]}for i in "${Array[@]}" ; do  echo 'Remove ' $i  find $i -ctime +${nDays} -type f | xargs rm -fvdone


参考:http://rainbird.blog.51cto.com/211214/114362