#!/bin/bash # wut-rm-random # # Does a coin flip to decide whether to remove a file or not. # Runs on directory specified below. # # XXX This script removes files and directories in data/ !!! XXX # # Usage: # wut-rm-random # Example: # wut-rm-random # NOTE: # In current unvetted-CW-8k dir: # 129*-132* = good # 133*-135* = bad # Number of waterfalls to keep: KEEP=100 # this is so bad no one should ever run it again #exit 0 # XXX Delete data in this directory! XXX cd /srv/satnogs/data/test/unvetted/ || exit TOTALFILES=`ls waterfall_*.png | wc -l` for wf in waterfall_*.png do \ if [ $TOTALFILES -gt $KEEP ] ; then RANDFLIP=`echo $((0 + RANDOM % 2))` if [ $RANDFLIP = 1 ] ; then rm -f $wf & fi let TOTALFILES=`ls waterfall_*.png | wc -l` else break fi done