#!/bin/bash  

# define resource
resource=matrixdb

# add the time stamped folder
cd /data/projects/glygen/downloads/$resource/

new_dir=$(date +%Y_%m_%d)
mkdir $new_dir

# download files to new folder
cd /data/projects/glygen/downloads/$resource/$new_dir
wget http://matrixdb.univ-lyon1.fr/download/Custom_MatrixDB_biomolecules.tsv &
wget http://matrixdb.univ-lyon1.fr/download/matrixdb_CORE.tab.gz &

wait # Wait until all downloads are complete

# unzip the file
gunzip *.gz

# update new folder permissions
chmod -R 775 /data/shared/glygen/downloads/$resource/$new_dir/

# create symbolic link
cd /data/projects/glygen/downloads/$resource/
rm current
ln -s $new_dir current
