rem oo.btm defrag all drives, uses TCC command processor
rem mark files as busy so automatic scheduled background tasks using files will abort.
rem bypassclean in an option
call E:\env\busy.btm

rem turn off file indexing
call E:\env\copernicclose.btm

if "%1" == "bypassclean" goto bypassclean
rem delete junk files, customised for my machine.
BatikRoedy.exe

rem touch dirs with today's date so the defrag will move them together.
echo touching dirs
touchdirs.exe -q C: D: E: F: G:

:bypassclean

rem possible commands ANALYSIS, OPTIMIZE, QUICK, COMPLETE, COMPNAME, COMPACC, COMPMOD, FRAGFILES, SPACE, STEALTH
rem SPACE undoes zones.
rem do the work in stages, so that if we abort early, we have done the most important work.

@echo  %_date %_time

rem call me over to poke Copernic to reindex
honk.exe "C:\Windows\Media\Calligraphy\Windows Hardware Fail.wav"
rem turn on file indexing
call E:\env\copernicstart.btm

@echo  %_date %_time
echo hit any key to stop indexing
rem give 120 mins = 7200 secs for indexing.
delay 7200  /B

rem turn off file indexing
call E:\env\copernicclose.btm

rem allow background tasks access to files again
call E:\env\unbusy.btm

exit
rem -30-