david_williams | e529817 | 2007-12-20 03:30:54 +0000 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | |
| 3 | |
| 4 | # remember to leave no slashes on filename in source command, |
| 5 | # (the commonVariations.shsource file, that is) |
| 6 | # so that users path is used to find it (first) |
| 7 | if [ -n $BUILD_INITIALIZED ] |
| 8 | then |
| 9 | source commonVariations.shsource |
| 10 | source ${BUILD_HOME}/releng.control/commonComputedVariables.shsource |
| 11 | fi |
| 12 | |
| 13 | # remove artifacts over n days old |
| 14 | # (where hours = 24 + (n * 24), basically, so that |
| 15 | # even n=0 means "1 day") |
| 16 | |
| 17 | n=4; |
| 18 | |
| 19 | echo " Removing artifact directories older than $n days"; |
| 20 | echo " number of directories before cleaning: "; |
| 21 | find ./ -mindepth 2 -maxdepth 2 | wc -l |
| 22 | |
| 23 | find ./ -mindepth 2 -maxdepth 2 -ctime +$n -exec rm -fr '{}' \; |
| 24 | |
| 25 | echo " number of directories after cleaning: "; |
| 26 | find ./ -mindepth 2 -maxdepth 2 | wc -l |