satnogs-wut/wut-rm-random

40 lines
789 B
Plaintext
Raw Normal View History

#!/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
2020-01-16 18:25:54 -07:00
# this is so bad no one should ever run it again
2020-01-16 19:25:44 -07:00
#exit 0
# XXX Delete data in this directory! XXX
2020-01-26 17:27:12 -07:00
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