Project.pm: do not unlink nonexistent file
[girocco.git] / toolbox / clear-all-htmlcache.sh
blob59b2d15b9880675fea7a511d255146ab7cd6d807
1 #!/bin/sh
3 # Remove all files present in the htmlcache subdirectory of each project.
4 # A count of projects that had files to be removed is displayed.
6 set -e
8 . @basedir@/shlib.sh
10 umask 002
12 base="$cfg_reporoot"
13 cut -d : -f 1 <"$cfg_chroot/etc/group" | grep -v "^_repo" |
15 count=0
16 while read proj; do
17 projdir="$base/$proj.git"
18 if cd "$projdir/htmlcache" 2>/dev/null; then
19 if [ "$(echo *)" != '*' ]; then
20 rm -f * 2>/dev/null
21 count=$(( $count + 1 ))
22 if [ $(( $count % 10 )) = 0 ]; then
23 printf '%s ' $count
27 done
28 if [ $(( $count % 10 )) != 0 ]; then
29 printf '%s ' $count
31 printf '%s\n' 'done'