#!/bin/csh -x

set JPG_DIR = /raid1/vlf/vlfath/spectrum

foreach j (2013/VLF01_*.jpg)
  set b = `basename $j`
  set year = `echo $b | cut -c7-10`
  set yymmdd  = `echo $b | cut -c9-14`

    echo "$year  $yymmdd"
 
    if( ! -d ${JPG_DIR}/${year} ) then
      mkdir ${JPG_DIR}/${year}
    endif 
    if( ! -d ${JPG_DIR}/${year}/${yymmdd}) then
      mkdir  ${JPG_DIR}/${year}/${yymmdd}
    endif 
    echo ${JPG_DIR}/${year}/${yymmdd}
    mv -f $j ${JPG_DIR}/${year}/${yymmdd}

end 

