#!/bin/bash

############ AUTOSUBMIT INPUTS ############
outdir=%common.OUTDIR%
expid=%config.EXPID%
###############################

#JSON directory
dir1=/esarchive/autosubmit/${expid}/tmp/$(basename ${outdir})/outputs/provenance

destdir1=/gpfs/archive/bsc32/${dir1}

#Recipes directory
dir2=/esarchive/autosubmit/${expid}/tmp/$(basename ${outdir})/logs/recipes

destdir2=/gpfs/archive/bsc32/${dir2}

#Create directories and copy files
mkdir -p ${destdir1}

cp -r /gpfs/archive/bsc32/${outdir}/outputs/provenance/* ${destdir1}

mkdir -p ${destdir2}

cp -r /gpfs/archive/bsc32/${outdir}/logs/recipes/* ${destdir2}