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

echo $DATETIMESTAMP

FOLDERNAME=echecs

ZIPNAME=c-$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

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
DIR=$HOME/Documents/lua/uploader
export LUA_PATH=$DIR/?.lua
lua $DIR/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
