b2-data-retention/b2-retention.sh

15 lines
245 B
Bash
Raw Normal View History

2024-12-28 07:16:14 +01:00
#!/usr/bin/env sh
TO_DELETE=$( b2v4 ls b2://"$BUCKET_NAME" | tac | tail -n +8 | tr '\n' ' ' )
PIDS=""
for file in $TO_DELETE; do
b2v4 rm "b2://${BUCKET_NAME}/${file}" &
PIDS="$PIDS $!"
done
for pid in $PIDS; do
wait "${pid}"
done