#!/bin/bash
dir=/root/tmp
targetdir=/root/tmp/tmp
filenametxt=/tmp/filename.txt
commandtxt=/tmp/command.txt
echo "">${filenametxt}
echo "">${commandtxt}

find ${dir} -name "mydumper*" -mtime +60  -type f -exec ls {} \;>${filenametxt}
cat ${filenametxt}|awk -F'_' '{print $2}'|while read line
do
week_day=`date --date=${line} +%u`
if [ ${week_day} != 5 ];then
echo "备份文件的生成日期是,星期"${week_day}
filename=`cat ${filenametxt}|grep $line`
cmd="mv "${filename}" "${targetdir} 
echo "生成移动命令:"${cmd}
echo $cmd>>${commandtxt}
fi 
done

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-05
  • 2021-09-10
  • 2022-12-23
  • 2021-06-23
  • 2021-11-17
猜你喜欢
  • 2021-12-06
  • 2021-11-13
  • 2021-08-30
  • 2021-10-17
  • 2022-12-23
  • 2021-11-14
相关资源
相似解决方案