@@ -73,12 +73,13 @@ echo "-v - show script run by qfds.sh for each validation case"
7373echo " -V - show qfds.sh command line for each validation case"
7474echo " -w walltime - default: empty, PBS: hh:mm:ss, SLURM: dd-hh:mm:ss"
7575echo " -x - do not copy FDS input files"
76- echo " -y - overwrite existing files"
76+ echo " -y - remove existing files"
77+ echo " -z - overwrite existing files"
7778exit
7879}
7980
8081DEBUG=
81- while getopts ' bCe:EhIj:m:o:Oq:r:suvVw:xy ' OPTION
82+ while getopts ' bCe:EhIj:m:o:Oq:r:suvVw:xyz ' OPTION
8283do
8384case $OPTION in
8485 b)
@@ -141,7 +142,12 @@ case $OPTION in
141142 export DONOTCOPY=1
142143 ;;
143144 y)
145+ export DELETEFILES=1
146+ export OVERWRITE=
147+ ;;
148+ z)
144149 export OVERWRITE=1
150+ export DELETEFILES=
145151 ;;
146152esac
147153done
@@ -174,12 +180,12 @@ if [ ! $STOPFDS ] ; then
174180 # Check for existence of $INDIR (Current_Results) directory
175181 if [ -d " $INDIR " ]; then
176182 # Check for files in $INDIR (Current_Results) directory
177- if [[ " $( ls -A $INDIR ) " && ! $OVERWRITE ]]; then
178- echo " Directory $INDIR already exists with files."
179- echo " Use the -y option to REMOVE existing files. "
183+ if [[ " $( ls -A $INDIR ) " && " $OVERWRITE " == " " && " $DELETEFILES " == " " ]]; then
184+ echo " The directory $INDIR already exists with files."
185+ echo " Use the -y option to REMOVE existing files or -z to OVERWRITE existing files "
180186 echo " Exiting."
181187 exit
182- elif [[ " $( ls -A $INDIR ) " && $OVERWRITE ]]; then
188+ elif [[ " $( ls -A $INDIR ) " && " $DELETEFILES " == " 1 " ]]; then
183189 rm $INDIR /*
184190 fi
185191 # Create $INDIR (Current_Results) directory if it doesn't exist
0 commit comments