Problem: a box is running out of free disk space. The contents are under control of git-annex. Automatically find and drop all large files that are properly backed up elsewhere.
#!/bin/bash my_annex="$HOME/annex" cd $my_annex let my_number=2+`echo $my_annex | tr "/" " " | wc -w` for i in `find $my_annex -xdev -size +5M | grep -v \.pack$`; do j=`basename $i` k=`find $my_annex -xdev -lname "*$j"` to_drop=`echo "$k" | cut -d "/" -f $my_number- ` if [[ -n $to_drop ]] ; then git-annex drop "$to_drop" fi done