From 7e61a4b4f1184657289555d8112226c77ffcf1b7 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 18 Apr 2018 14:36:35 +0200 Subject: Nicer utils --- odin/strm/cleanup_youtube | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'odin/strm') diff --git a/odin/strm/cleanup_youtube b/odin/strm/cleanup_youtube index 2d91fe1f..76c3f0bb 100644 --- a/odin/strm/cleanup_youtube +++ b/odin/strm/cleanup_youtube @@ -19,19 +19,7 @@ function cleanup { urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; } -dir=/srv/media/youtube -maxsize=$((1024 * 1024 * 1024 * 50)) - -while [[ $(du -bs $dir | awk '{ print $1; }') -gt $maxsize ]]; do - find $dir -type f -not -path $dir/CACHEDIR.TAG -print0 | \ - xargs -0 -- stat --printf '%W %Y %Z %X %n\0' | \ - sort -t '\0' -z | \ - awk -F '\0' '{ gsub("^\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+", "", $1); printf "%s\0", $1; }' | \ - xargs -0 -- rm -v -done - -find $dir -xtype l -delete -find $dir -type d -empty -delete +@rollingdirectory@/bin/rolling-directory /srv/media/youtube 50Gi notmuch search --output=messages --format=text 'is:cached' | \ while read id; do -- cgit v1.2.3