Skip to content

🧼 Clean S3

🧼 Clean S3 #26

Workflow file for this run

name: 🧼 Clean S3
on:
schedule:
- cron: "5 1 */7 * *"
workflow_dispatch:
jobs:
clean_s3:
runs-on: ubuntu-22.04
steps:
- run: |
sudo apt install -y s3cmd
echo "${{ secrets.S3CMD_CFG }}" > ~/.s3cfg
# Delete files older than 120 days
s3cmd ls -r s3://qfieldapks/ | awk -v dys="120" 'BEGIN { depoch=(dys*86400);cepoch=(systime()-depoch) } { gsub("-"," ",$1);gsub(":"," ",$2 );if (mktime($1" "$2" 00")<=cepoch) { print "s3cmd del "$4 } }' | bash
s3cmd du s3://qfieldapks/