#!/bin/bash  

# define resource
resource=atlas_oglcnac

# 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

# update file names here if the version changes
wget -4 -O ambiguous_sites.csv "https://oglcnac.org/static/dataset/Atlas%205.0_ambiguous%20sites_20251208.csv?v=20260523" &
sleep 5
wget -4 -O unambiguous_sites.csv "https://oglcnac.org/static/dataset/Atlas%205.0_unambiguous%20sites_20251208.csv?v=20260523" &

wait # Wait until all downloads are complete

# 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
