
#DATETIMESTAMP=$(date +"%y%m%d%H%M")
DATETIMESTAMP=$(date +"%y%m%d")

echo $DATETIMESTAMP

FOLDERNAME=sankit

ZIPNAME=$FOLDERNAME-$DATETIMESTAMP.zip
DEST1=/run/media/roland/CHASTAIN-1/sauvegardes
DEST2=/home/roland/Documents/site/public_html/roland/sauvegardes

find . -name "*.o" -print -delete

pushd ..

zip -r $ZIPNAME $FOLDERNAME \
 -x $FOLDERNAME/sankit/\.git/\* \
 -x $FOLDERNAME/sankit-minimal-engine/\.git/\*

if [ -d $DEST1 ]; then
  cp -fv $ZIPNAME $DEST1
else
  echo "[WARNING] Cannot find directory $DEST1"
fi

mv -fv $ZIPNAME $DEST2

#echo $DEST2/$ZIPNAME > file.txt && uploader file.txt

echo $DEST2/$ZIPNAME > files.txt
SCRIPTDIR=$HOME/Documents/lua/uploader
export LUA_PATH=$SCRIPTDIR/?.lua
lua $SCRIPTDIR/upload.lua files.txt
popd

exit 0

pushd ..
zip -r $FOLDERNAME-$DATETIMESTAMP.zip $FOLDERNAME -x $FOLDERNAME/\.git/\* -x $FOLDERNAME/\*\.sh
cp -fv $FOLDERNAME-$DATETIMESTAMP.zip /run/media/roland/CHASTAIN-1/sauvegardes/
mv -fv $FOLDERNAME-$DATETIMESTAMP.zip $HOME/Documents/site/public_html/roland/echecs-aleatoires-fischer/sources.zip
popd
