-function copy_over () {
- # Move file to its offsite destination
- # $1: file, $2: relative directory (optional)
- if test -z "$1" || test -n "$3"; then
- echo "Bad programming"
- exit 1
- fi
- local FILE=$1
- local DEST=$BACKUPDIR/$SUBDIR
- if test -n "$2"; then
- DEST=$DEST/$2
- fi
- < $FILE catsync -b $BWLIMIT $DEST/$FILE
- rm -f $FILE
-}
-
-cd $BACKUPDIR
-find . -mindepth 1 -maxdepth 1 -type d -ctime +10 \
- -execdir rm -fr '{}' \; || true
-rm -rf $SUBDIR
-mkdir -p $SUBDIR
+IFS=$'\n'
+
+# Initialize storage area
+RSYNCDIR=/vicepa/hcoop-backups/files
+rm -fr $RSYNCDIR
+mkdir -p $RSYNCDIR/$CURDATE
+chmod og=rx,u=rwx $RSYNCDIR
+chmod og= $RSYNCDIR/$CURDATE
+
+# Initialize backup staging area