+### create a symlink in same dir
+# arguments
+# actual : full path of the actual file
+# link : the link name, only basename is used, will be created in same dir
+function manage_link () {
+ actual=$1; shift
+ latest=$1; shift
+ # go in the right directory
+ cd $(dirname $actual)
+ actualbase=$(basename $actual)
+ # just in case
+ latest=$(basename $latest)
+ echo "In $(pwd) : linking $actualbase to $latest"
+ rm -f $latest ; ln -s $actualbase $latest
+ # go back to current dir
+ cd -
+}
+
+# usage
+# clean <where> <keeptime> [... find arguments]
+function clean () {
+ where=$1; shift
+ keeptime=$1; shift
+ echo "== In $where"
+ echo "Cleaning $@ - older than $keeptime days"
+ find $where "$@" -atime +$keeptime | xargs rm
+}