#! /bin/csh -f # Last edited on 2003-11-04 01:31:59 by stolfi set usage = "$0 DIR ICONSIZE" # Replaces all symbolic links named "p-icon.png" under directory DIR by # symbolic links to "p-SIZE.png". Checks whether the latter exists. set dir = "$1"; shift; set size = "$1"; shift; set tmp = "/tmp/$$" if ( $#argv != 0 ) then echo "usage: $usage"; exit 1 endif cd ${dir} || ( echo "can't cd to ${dir}"; exit 1 ) || exit 1 find ./ -type l -name 'p-icon.png' -print > ${tmp} foreach f ( `cat ${tmp}` ) echo $f set g = "${f:h}/p-${size}.png" if ( -r $g ) then /bin/rm $f && ln -s $g $f else echo "** $g not found" endif end find ./ \( \! -type l \) -name 'p-icon.png' -print > ${tmp}.nl if ( ! ( -z ${tmp}.nl ) ) then echo "non-link icons (not touched):" cat ${tmp}.nl endif /bin/rm -f ${tmp} ${tmp}.nl