shell查找七天之前的文件

#!/bin/bash
aweekago=`date -d "7 days ago" +%s`
for f in $(ls)
do
stat -c %Y ${f}
aa=`stat -c %Y "${f}"`
echo "${f} createtime is ${aa}"
if [ ${aweekago} -lt ${aa} ];then
echo "yes"
fi
done

posted @ 2019-09-06 19:20  少年曾续缘  阅读(1032)  评论(0编辑  收藏  举报