# Splits /dimv9p_enc/data/radrev/2005/187 into smaller subdirectories 
# of about 450-500 MB each.
#
# 2006-10-12, sam:  Ran this script in the /n/diraid02/data/lien/data/ 
# area which has not been touched since the data were copied to 
# /n/pdsraid01/archive/, then moved the tars to /n/pdsraid01/archive/.
#

cd /n/diraid02/data/lien/dimv9p_enc/data/radrev/2005/

mkdir 187a
mkdir 187b
mkdir 187c
mkdir 187d


# Use the exposure ID in the file names to move data from
# the daily directory to the 'part' directories

mv 187/*_91200* 187a/
mv 187/*_91300* 187a/
mv 187/*_91400* 187c/
mv 187/*_91500* 187d/


# Make sure 187 directory is empty

find 187/

cd /n/diraid02/data/lien/dimv9p_enc/

tar cvf DOWNLOAD/2005187a.tar data/radrev/2005/187a
tar cvf DOWNLOAD/2005187b.tar data/radrev/2005/187b
tar cvf DOWNLOAD/2005187c.tar data/radrev/2005/187c
tar cvf DOWNLOAD/2005187d.tar data/radrev/2005/187d

mv DOWNLOAD/2005187a.tar /n/pdsraid01/archive/dimv9p_enc/DOWNLOAD/
mv DOWNLOAD/2005187b.tar /n/pdsraid01/archive/dimv9p_enc/DOWNLOAD/
mv DOWNLOAD/2005187c.tar /n/pdsraid01/archive/dimv9c_enc/DOWNLOAD/
mv DOWNLOAD/2005187d.tar /n/pdsraid01/archive/dimv9d_enc/DOWNLOAD/

# Move data back from 'part' directories back to the original DOY directory

cd /n/diraid02/data/lien/dimv9p_enc/data/radrev/2005/

mv 187a/* 187/
mv 187b/* 187/
mv 187c/* 187/
mv 187d/* 187/