blob: 54cf1b8d3fd4dd0c1ad9133c831489c04b8437ee [file] [log] [blame]
jlanuti6f30d402007-04-18 19:54:42 +00001#!/bin/sh
2# script to delete warm-up builds, except the one promoted
3# the promoted on is left just for safety
4
5
6declaredStream=$1
7declaredDir=$2
8# make sure directories to delete start with same 3 chars as target
9pattern=${declaredDir:0:5}
10
11
12echo restrict to directory names that match $pattern
13echo act on directories older than $declaredDir
14
15
16# example of full form from command line
17# find ./drops -maxdepth 1 -type d -name I-I* -not -cnewer drops/I-I200603180020-200603180020 -exec rm -fr {} \;
18
19
20if [ "$3" != "-doit" ] ; then
21 echo " This is a dry run. Add -doit to actually remove"
22 thisCommand=" echo "
23else
24 thisCommand=" rm -fr "
25fi
26
27
28
29find ./drops -maxdepth 2 -type d -name "$pattern*" -not -newer "./drops/$declaredStream/$declaredDir" -exec $thisCommand {} \;
30
31
32
33