Skip to content

Instantly share code, notes, and snippets.

@ice2heart
Created August 5, 2016 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ice2heart/5ceec200740a648c3a092b9c9de0871f to your computer and use it in GitHub Desktop.
Save ice2heart/5ceec200740a648c3a092b9c9de0871f to your computer and use it in GitHub Desktop.
#!/bin/bash
#0 */2 * * * /home/jenkins/expire.sh # in crontab -e
DIR=/home/ice/tmp/56866493
FILES="*.mp4"
let "EXPIRETIME=172800" # expire time in seconds
cd $DIR
for f in $FILES
do
NOW=$(date +%s)
FCTIME=$(stat -c %Y "$f")
let AGE=$NOW-$FCTIME
if [[ $AGE -gt $EXPIRETIME ]] ; then
rm -f "$f"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment