#!/bin/bash
echo ======= `date` =======

chem_from=/disk2/bmech/lsc
life_from=/disk2/bmech/lse
chem_to="/disk2/ccod/chem.phy/20"
life_to="/disk2/ccod/life.sci/20"

Unzip_life(){
unzip -qn $file -d  $life_to${file:17:2}
echo $life_to${file:17:2}/${file:17:9}"ISE" 
}
Unzip_chem(){
unzip -qn $file -d  $chem_to${file:17:2}
echo $chem_to${file:17:2}/${file:17:9}"ISC"
}

for file in $(find $chem_from -type f -mtime -3)
do
    if [ -d $chem_to${file:17:2} ]
    then
     Unzip_chem
    else
     mkdir $chem_to${file:17:2}
     chmod 755 $chem_to${file:17:2}
     Unzip_chem
    fi
done 
   
for file in $(find $life_from -type f -mtime -3)
do
    if [ -d $life_to${file:17:2} ]
    then
     Unzip_life
    else
     mkdir $life_to${file:17:2}
     chmod 755 $life_to${file:17:2} 
     Unzip_life
    fi 
done
