#! /bin/tcsh -f

#
# mksubjdirs
#
# REPLACE_WITH_ONE_LINE_SHORT_DESCRIPTION
#
# Original Author: REPLACE_WITH_FULL_NAME_OF_CREATING_AUTHOR
# CVS Revision Info:
#    $Author: nicks $
#    $Date: 2007/01/06 00:01:14 $
#    $Revision: 1.4 $
#
# Copyright (C) 2002-2007,
# The General Hospital Corporation (Boston, MA).
# All rights reserved.
#
# Distribution, usage and copying of this software is covered under the
# terms found in the License Agreement file named 'COPYING' found in the
# FreeSurfer source code root directory, and duplicated here:
# https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferOpenSourceLicense
#
# General inquiries: freesurfer@nmr.mgh.harvard.edu
# Bug reports: analysis-bugs@nmr.mgh.harvard.edu
#



if ($#argv != 1) then
  echo "usage: mksubjdirs <subj_name>"
  exit
endif

if(-e $1) then
  echo "ERROR: $1 already exists"
  exit 1;
endif

mkdir $1
if($status) then
  echo "ERROR: creating directory $1"
  exit 1;
endif


chmod g+rws $1
cd $1
mkdir -p bem mri rgb scripts surf tmp label morph mpg tiff touch stats
mkdir -p mri/transforms mri/aseg mri/fsamples mri/norm mri/T1 \
         mri/brain mri/filled mri/orig mri/tmp mri/wm mri/flash \
         mri/flash/parameter_maps
chmod -R g+rw .

echo " "
echo "REMEMBER to do a 'chgrp -R r_group' for the right group if needed."
echo "    All directories where just created as group writable."
echo "    Use the 'id' command to get a list of your groups."
echo " "


set um=`umask`
if ($um != 2) then
  echo " "
  echo "WARNING: your umask is not 002! New files will not be group writable."
  echo "This is a warning only, it is not an error."
  echo " "
endif

echo "Creation of subject directory complete."
echo "See recon-all -help for more info on how to proceed."
echo " "


exit 0;
