[linux] linux shell 将解析完毕的文件备份至其他目录
#!/bin/bash
#
#将解析完毕的日志备份到别的目录
#
#日志目录
rjPath=`ls /home/bgftp/orj`
#当前时间戳
cur=`date +%s`
#一小时
chtm=3600000
for rpath in $rjPath
do
#获取文件的时间戳
ctm=`date +%s -r /home/bgftp/orj/$rpath`
subct=$[cur*1000-ctm*1000]
#大于一小时的日志备份
if [ "$subct" -gt "$chtm" ]
then
`mv /home/bgftp/orj/$rpath /home/bgftp/orjback`
fi
done

浙公网安备 33010602011771号