Created
October 20, 2012 22:50
-
-
Save elchappo/3925109 to your computer and use it in GitHub Desktop.
PHP resizer sentinel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CACHEDIR= | |
MAXSIZE=100 | |
DIRSIZE=`du -s $CACHEDIR | cut -f 1` | |
MINFILES=5 | |
echo $DIRSIZE' : '$CACHEDIR | |
#ls -t cache | sed -e '1,10d' | xargs -d '\n' rm | |
if [ $DIRSIZE -gt $MAXSIZE ]; then | |
echo 'Removing files...' | |
find $CACHEDIR -maxdepth 1 -mindepth 1 -printf '%T+ %p\n' | sort -r | tail -n +$MINFILES | xargs rm -rf | |
echo 'Done' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment