#!/bin/tcsh # ----------------------------------------------------------------- # This script is mean to delete all of the data created by the # processing scripts. Depending on the usage, goals are to: # - delete the group_data directory # - for each (given) subject # - move the spgr datasets to a temp directory # - move the original EPI data to a temp directory # - delete the contents of the subject directory # - move everything from the temp dir to the subject dir # - delete the temp dir, if created # ----------------------------------------------------------------- if ( $#argv < 1 ) then echo usage: $0 ED EE EF ... echo usage: $0 group_data echo usage: $0 all exit endif set group = 0 set subjects = ( ) if ( $argv[1] == all ) then set subjects = ( E? F? ) set group = 1 else if ( $argv[1] == group_data ) then set group = 1 else set subjects = ( $argv ) endif set tdir = tmp.orig if ( $#subjects > 0 ) then mkdir $tdir if ( $status != 0 ) then echo failed to create temp dir, $tdir exit endif endif if ( $group && -d group_data ) then echo removing group_data... rm -fr group_data endif foreach subj ( $subjects ) if ( ! -d $subj ) then echo no subject directory: $subj continue else if ( $subj == group_data ) then # extra check for group_data echo removing group_data... rm -fr group_data continue endif cd $subj if ( -f {$subj}spgr+orig.HEAD || -f ${subj}spgr+tlrc.HEAD ) then echo storing {$subj}spgr datasets... mv {$subj}spgr+* ../$tdir endif if ( -f {$subj}mprage1+orig.HEAD ) then echo storing {$subj}mprage datasets... mv {$subj}mprage* ../$tdir endif if ( -f {$subj}_r1+orig.HEAD ) then echo storing top {$subj}_rX datasets... mv {$subj}_r?+orig.* ../$tdir mv {$subj}_r??+orig.* ../$tdir endif if ( -d runs_orig ) then echo storing saved {$subj}_rX datasets... mv runs_orig/* ../$tdir endif echo removing all old data for $subj ... rm -fr * echo restoring original data for $subj ... mv ../$tdir/{$subj}* . cd .. end if ( -d $tdir ) rm -fr $tdir