From a01f61f4329eff97abc20f13d765bc885b1235ab Mon Sep 17 00:00:00 2001 From: fritz-smh Date: Wed, 8 Jun 2016 22:00:49 +0200 Subject: [PATCH] PR #23 Create Script detele file or videos after few days --- sd/test/scripts/README.md | 6 ++++++ sd/test/scripts/cleanup.sh | 14 ++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 sd/test/scripts/cleanup.sh diff --git a/sd/test/scripts/README.md b/sd/test/scripts/README.md index 39c92e2..6358ccc 100644 --- a/sd/test/scripts/README.md +++ b/sd/test/scripts/README.md @@ -18,3 +18,9 @@ Source of the script : * https://github.com/fritz-smh/yi-hack/pull/24 * http://4pda.ru/forum/index.php?showtopic=638230&st=2780#entry44208114 +cleanup.sh +========== + +This script will cleanup video files older than 15 days. + +You need to add it in the crontab diff --git a/sd/test/scripts/cleanup.sh b/sd/test/scripts/cleanup.sh new file mode 100644 index 0000000..5003ac3 --- /dev/null +++ b/sd/test/scripts/cleanup.sh @@ -0,0 +1,14 @@ +#!/bin/sh +#Delete files and folders more than 15 days + +dir="/home/hd1/record/" +days=+15 +dt=`date +%y%m%d` +#echo $dir +#echo $days +#echo $dt +#Command: +du -sh ${dir} > ${dir}Delete_$dt.log +find ${dir} -mtime $days -exec rm -Rf {} \; +du -sh ${dir} >> ${dir}Delete_$dt.log +echo "Works!"