#!/bin/bash
ALL_DIRS="postdocs phd-students adjunct-professor researchers leadership-and-administration principal-investigators affiliated master-students young-researcher-parliament alumni board-of-directors scientific-advisory-committee"
DIRS=$ALL_DIRS

#To generate index.html (no,eg) for a single diretory unncomment the next line
#DIRS="adjunct-professor master-students researchers alumni leadership-and-administration"
DIRS="postdocs"



TMP=/tmp/trash
mkdir -p $TMP
DATE=`date '+%Y-%m-%d_%H:%M:%S'`
for DIR in $DIRS; do
  echo "Backup of "$DIR"/people_list.txt - with date:" $DATE
  cp $DIR/people_list.txt $DIR/bkp_people_list_${DATE}
  cp ../../personer/$DIR/index.html ../../personer/$DIR/bkp_index_${DATE}
  echo "Generating "$DIR"/index.html (English and Norwegian)"
  sh make_people_list.sh $TMP/index_en.html $TMP/index_no.html < $DIR/people_list.txt > /dev/null
  cp $TMP/index_en.html $DIR/index.html
  cp $TMP/index_no.html ../../personer/$DIR/index.html
done
