Files
q-tools/aerofs/aerofs-clean
2013-11-09 10:15:20 +02:00

34 lines
782 B
Bash
Executable File

#!/bin/bash
MyRoot=$( sqlite3 $HOME/.aerofs/conf "SELECT v FROM c WHERE k = 'root';" )
MyDir=$( dirname "$MyRoot" )
AEROAUX=($MyDir/.aerofs.aux*)
function cacheusage {
find "$AEROAUX/" -mindepth 1 -maxdepth 1 -exec du -sh \{\} \;
}
if [ -z "$1" ]
then echo partial/revisions/conflicts: '(-f to delete all. -p/-r to delete +3 days)'
cacheusage
exit 0
fi
while getopts "fpr" OPTS;
do case ${OPTS} in
f)
find "$AEROAUX/r" -mindepth 1 -depth -exec rm -Rf \{\} \;
find "$AEROAUX/p" -mindepth 1 -depth -exec rm -Rf \{\} \;
;;
r)
find "$AEROAUX/r" -mindepth 1 -type f -mtime +3 -exec rm -Rf \{\} \;
;;
p)
find "$AEROAUX/p" -mindepth 1 -type f -mtime +3 -exec rm -Rf \{\} \;
;;
esac
done
cacheusage