Index: /trunk/DataCheck/Sourcefile.sh
===================================================================
--- /trunk/DataCheck/Sourcefile.sh	(revision 17076)
+++ /trunk/DataCheck/Sourcefile.sh	(revision 17077)
@@ -472,3 +472,41 @@
 }
 
-
+function getdates()
+{
+   case $1 in
+      # all dates
+      all) 
+         printprocesslog "DEBUG getdates case 'all'"
+         dates=( `find -L $ziprawdata -mindepth 3 -type d | sort -r | sed "s/\${ziprawdata_for_sed}//g" | sed -e 's/^\///'` ) #all available dates in /loc_data/zipraw
+         ;;
+      # certain date
+      [0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9])
+         printprocesslog "DEBUG getdates case certain date: "$1
+         dates=( $1 )
+         ;;
+      # certain number of dates (between 0 and 99 )
+      [0-9][0-9]|[0-9])
+         # get last n nights
+         for (( numdates=1 ; numdates <= $1 ; numdates++ ))
+         do 
+            numhours=`echo " 12 + ( $numdates - 1 ) * 24 " | bc -l`
+            dates=( ${dates[@]} `date +%Y/%m/%d --date="-"$numhours"hour"` )
+         done
+         # hour-dependent number of dates
+         if [ "$2" != "" ] && [ "$3" != "" ]
+         then 
+            # get current hour
+            hour=`date +%k`
+            if [ $hour -le $3 ] || [ $hour -ge $2 ]
+            then
+               dates=( `date +%Y/%m/%d --date="-12hour"` )
+            fi
+         fi
+         ;;
+      *) # nothing valid given
+         echo "Please give valid options for the function 'getdates()'"
+         finish
+         ;;
+   esac
+}
+
