# Splits /dimv9p_enc/data/radrev/2005/180 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 180a
mkdir 180b
mkdir 180c
mkdir 180d
mkdir 180e


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

mv 180/*_81001* 180a/
mv 180/*_820000* 180a/
mv 180/*_820001* 180a/

mv 180/*_820002* 180b/
mv 180/*_820003* 180b/
mv 180/*_820004* 180b/
mv 180/*_820005* 180b/
mv 180/*_820006* 180b/
mv 180/*_820007* 180b/
mv 180/*_820008* 180b/

mv 180/*_820009* 180c/
mv 180/*_820010* 180c/
mv 180/*_820011* 180c/
mv 180/*_820012* 180c/
mv 180/*_820013* 180c/
mv 180/*_820014* 180c/

mv 180/*_820015* 180d/
mv 180/*_820016* 180d/
mv 180/*_820017* 180d/
mv 180/*_820018* 180d/
mv 180/*_830000* 180d/
mv 180/*_830001* 180d/

mv 180/*_83000* 180e/
mv 180/*_84000* 180e/

# Make sure 180 directory is empty

find 180/

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

tar cvf DOWNLOAD/2005180a.tar data/radrev/2005/180a
tar cvf DOWNLOAD/2005180b.tar data/radrev/2005/180b
tar cvf DOWNLOAD/2005180c.tar data/radrev/2005/180c
tar cvf DOWNLOAD/2005180d.tar data/radrev/2005/180d
tar cvf DOWNLOAD/2005180e.tar data/radrev/2005/180e


mv DOWNLOAD/2005180a.tar /n/pdsraid01/develop/dif-c-mri-3-nav-9p-encounter-v1.0/DOWNLOAD/
mv DOWNLOAD/2005180b.tar /n/pdsraid01/develop/dif-c-mri-3-nav-9p-encounter-v1.0/DOWNLOAD/
mv DOWNLOAD/2005180c.tar /n/pdsraid01/develop/dif-c-mri-3-nav-9p-encounter-v1.0/DOWNLOAD/
mv DOWNLOAD/2005180d.tar /n/pdsraid01/develop/dif-c-mri-3-nav-9p-encounter-v1.0/DOWNLOAD/
mv DOWNLOAD/2005180e.tar /n/pdsraid01/develop/dif-c-mri-3-nav-9p-encounter-v1.0/DOWNLOAD/

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

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

mv 180a/* 180/
mv 180b/* 180/
mv 180c/* 180/
mv 180d/* 180/
mv 180e/* 180/