.k ""

set src ""          ;default source directory !
set dest ""         ;default destination directory!
set options ""

echo "Executing BackUpUp"

set >nil: src `requestfile TITLE "Select source" DRAWERSONLY`

set >nil: dest `requestfile TITLE "Select destination" DRAWERSONLY SAVEMODE`

if 1 eq `requestchoice "UpDateCopy" "Enable option: ALL?" "Yes" "No"`
 set options "$options ALL"
endif

if 1 eq `requestchoice "UpDateCopy" "Enable option: DEEP?" "Yes" "No"`
 set options "$options DEEP"
endif

if 1 eq `requestchoice "UpDateCopy" "Enable option: FORCE?" "Yes" "No"`
 set options "$options FORCE"
endif

if 1 eq `requestchoice "UpDateCopy" "Enable option: QUIET?" "Yes" "No"`
 set options "$options QUIET"
endif

if 1 eq `requestchoice "UpDateCopy" "Enable option: PRINT?" "Yes" "No"`
 set options "$options >prt:"
endif

if 0 eq `requestchoice "UpDateCopy" "Execute*nUpDateCopy $src $dest $options *n?" "*Yes" "No"`
 echo "*N*NAbort!*N*N"
 skip exit
endif

date >env:start
echo "*N          Started:" $start

echo "*N  Execution of the:"
echo "      updatecopy " "$src" "$dest" $options
echo "  (abort pressing CTRL+C !)*N"

updatecopy "$src" "$dest" $options

echo "*N          Started:" $start
date >env:stop
echo "          Stopped:" $stop

unsetenv start
unsetenv stop

set b1 .backdrop
set b2 .backdrop-
set b3 .backdrop.info
set b4 .backdrop-.info

if exists $dest$b1

  if 1 eq `requestchoice "UpDateCopy" "Rename $dest$b1 as $dest$b2?" "*Yes" "No"`

    if exists $dest$b2
      delete $dest$b2 force quiet
    endif
    rename $dest$b1 $dest$b2

    if exists $dest$b3
      if exists $dest$b4
        delete $dest$b4 force quiet
      endif
      rename $dest$b3 $dest$b4
    endif

  endif
endif

lab exit
echo "*N*NFinished. Press close gadget for exit!"
