linux 定时删除脚本,linux定时删除文件脚本

#! /bin/sh

# 配置项

DEBUG=true

folderDir=/var/www/html/hlsrecord/

EXPIRE_DAY=1

# 过期时间和时间戳

deadTime=`date -d "-$EXPIRE_DAY day" +%Y-%m-%d`

$DEBUG && echo $deadTime

deadTimeStamp=`date -d $deadTime +%s`

$DEBUG && echo $deadTimeStamp

arrDir[0]='/var/www/html/hlsrecord/1126058978652760/2018-10-29'

arrDir[1]='/var/www/html/hlsrecord/1293636441140558/2018-10-28'

for dirPath in ${arrDir[*]}

# for file in `find /tmp -mindepth 2 -ctime +1 `

do

`$DEBUG && echo $dirPath`

folderName=`basename $dirPath`

`$DEBUG && echo $folderName`

#folder named by time, 2016-11-01

folderNameTimeStamp=`date -d $folderName +%s`

`$DEBUG &&a

你可能感兴趣的:(linux,定时删除脚本)