b2-data-retention/b2-retention.sh
2024-12-28 00:16:14 -06:00

14 lines
245 B
Bash
Executable file

#!/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