From 891dc82a1bdaf04192487fac0abc834a9f22a10d Mon Sep 17 00:00:00 2001 From: rowan Date: Sat, 28 Dec 2024 00:49:37 -0600 Subject: [PATCH] make file retention count variable --- b2-retention.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/b2-retention.sh b/b2-retention.sh index 0ba056b..85f346a 100755 --- a/b2-retention.sh +++ b/b2-retention.sh @@ -1,6 +1,8 @@ #!/usr/bin/env sh -TO_DELETE=$( b2v4 ls b2://"$BUCKET_NAME" | tac | tail -n +8 | tr '\n' ' ' ) +FILE_QUOTA=${FILE_QUOTA:-7} +FILE_QUOTA=$(("$FILE_QUOTA" + 1)) +TO_DELETE=$( b2v4 ls b2://"$BUCKET_NAME" | tac | tail -n +"$FILE_QUOTA" | tr '\n' ' ' ) PIDS="" for file in $TO_DELETE; do