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

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

rem allow batikAcer to change access bits on dirs
fsutil behavior set disablelastaccess 0

rem delete junk files, customised for my machine.
batikacer.exe

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

rem restart the O&O service
call oor.bat

rem possible commands ANALYSIS, OPTIMIZE, QUICK, COMPLETE, COMPNAME, COMPACC, COMPMOD, FRAGFILES, SPACE, STEALTH

rem do the work in stages, so that if we abort early, we have done the most important work.

OODCMD /QUICK:C,D,E,F,G
OODCMD /OPTIMIZE:D,E,F,G
OODCMD /OPTIMIZE:C

rem turn on file indexing
call E:\env\copernicstart.bat
rem give 30 mins = 1800 secs to admire results, indexing can proceed.

echo hit any key to stop indexing
delay 1800  /B

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

rem final thorough defrag
OODCMD /COMPLETE:D,E,F,G
OODCMD /COMPLETE:C

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

rem leave file indexing off.
exit

rem -30-