@echo off
set _ck_=c:\tools\crc\chkemM.exe
if not exist %_ck_% set _ck_=f:\uc\tools\crc\chkemM.exe

set _dt_=misc\dtsync
set _cs_=file\cs
set _nl_=text\newline
set _wi_=file\with
set _lf_=file\dirbat
set _arc_=pkzip
set _arc_=zip
set _ext_=zip
set _astro_=1/2/2002 20:45
set _frozen_=1/2/2000 20:45
rem the YACWOT strikes again... and against frozen status :-(
rem (Yet Another Complete Waste Of Time)
set _frozen_=1/2/2012 19:45

if not "%1" == "Q&D" goto syntax
if     "%2" == "CHK" goto chk
if not "%2" == ""    goto syntax


ren WIN31\*.EXE     *.EX!
ren UNZIP.EXE   UNZIP.EX!
ren   ZIP.EXE     ZIP.EX!
%_wi_% -e -s -v *.exe        "$c /?  > $u$d$n.doc"
ren WIN31\*.EX!     *.EXE
ren UNZIP.EX!   UNZIP.EXE
ren   ZIP.EX!     ZIP.EXE

rem more help

%_wi_% -e -s -v textgen.exe  "$c /?? > $u$d$n.doc"
%_wi_% -e -s -v gematria.exe "$c /?? > $u$d$n.doc"
%_wi_% -e -s -v newline.exe  "$c /?? > $u$d$n.doc"
%_wi_% -e -s -v daymonth.exe "$c /?? > $u$d$n.doc"
%_wi_% -e -s -v dths.exe     "$c /?? > $u$d$n.doc"
%_wi_% -e -s -v dirbat.exe   "$c /?? > $u$d$n.doc"
%_wi_% -e -s -v with.exe     "$c /?? > $u$d$n.doc"
%_wi_% -e -s -v picfind.exe  "$c /?? > $u$d$n.doc"
%_wi_% -e -s -v xd.exe       "$c /?? > $u$d$n.doc"
%_wi_% -e -s -v uclone.exe   "$c /?? > $u$d$n.doc"
%_wi_% -e -s -v spiro.exe    "$c /?? > $u$d$n.doc"
%_wi_% -e -s -v dt.exe       "$c /?? > $u$d$n.doc"

%_wi_% -e -s -v pcopy.exe    "$c /??? > $u$d$n.doc"

%_wi_% -e -s -v dd.exe       "$c /??? > $u$d$n.doc"

%_wi_% -e -s -v vital.exe    "$c /??  >  $u$d$n.doc"
%_wi_% -e -s -v vital.exe    "$c /??? >> $u$d$n.doc"

del chkem.doc
if exist win31\*.doc del win31\*.doc

%_wi_% -lfn -d -s -v *.* "%_dt_% -y %_frozen_% $c\*.*"
REM DIRBAT *.* /d /s "cd $n$_copy ..\readme?.txt$_$p_arc_$p $n$_move $n.zip ..$_cd.."

cd FILE
copy ..\readme?.txt
%_arc_% FILE *.*
move FILE.%_ext_% ..
cd..
cd FILE_S
copy ..\readme?.txt
%_arc_% FILE_S *.*
move FILE_S.%_ext_% ..
cd..
cd TEXT
copy ..\readme?.txt
%_arc_% TEXT *.*
move TEXT.%_ext_% ..
cd..
cd TEXT_S
copy ..\readme?.txt
%_arc_% TEXT_S *.*
move TEXT_S.%_ext_% ..
cd..
cd VIDEO
copy ..\readme?.txt
%_arc_% VIDEO *.*
move VIDEO.%_ext_% ..
cd..
cd VIDEO_S
copy ..\readme?.txt
%_arc_% VIDEO_S *.*
move VIDEO_S.%_ext_% ..
cd..
cd MISC
copy ..\readme?.txt
%_arc_% MISC *.*
move MISC.%_ext_% ..
cd..
cd MISC_S
copy ..\readme?.txt
%_arc_% MISC_S *.*
move MISC_S.%_ext_% ..
cd..
cd HACK
copy ..\readme?.txt
%_arc_% HACK *.*
move HACK.%_ext_% ..
cd..
cd HACK_S
copy ..\readme?.txt
%_arc_% HACK_S *.*
move HACK_S.%_ext_% ..
cd..
cd FUN
copy ..\readme?.txt
%_arc_% FUN *.*
move FUN.%_ext_% ..
cd..
cd FUN_S
copy ..\readme?.txt
%_arc_% FUN_S *.*
move FUN_S.%_ext_% ..
cd..
cd WIN31
copy ..\readme?.txt
%_arc_% WIN31 *.*
move WIN31.%_ext_% ..
cd..
cd M2LIB_S
copy ..\readme?.txt
%_arc_% M2LIB_S *.*
move M2LIB_S.%_ext_% ..
cd..
cd PBLIB_S
copy ..\readme?.txt
%_arc_% PBLIB_S *.*
move PBLIB_S.%_ext_% ..
cd..
cd WIN31_S
copy ..\readme?.txt
%_arc_% WIN31_S *.*
move WIN31_S.%_ext_% ..
cd..

cd BATDOS
copy ..\readme?.txt
%_arc_% BATDOS *.bat
move BATDOS.%_ext_% ..
cd..

cd BAT98SE
copy ..\readme?.txt
%_arc_% BAT98SE *.bat
move BAT98SE.%_ext_% ..
cd..

cd BATXP
copy ..\readme?.txt
%_arc_% BATXP *.bat
move BATXP.%_ext_% ..
cd..

rem special
cd QDASTRO
del *.doc
..\%_wi_% -e -v *.exe     "$c /?  > $n.txt"
..\%_wi_% -e -v with.exe  "$c /?? > $n.txt"
..\%_wi_%    -v -lfn *.*    "..\%_dt_% -y %_astro_% *.*"
..\%_lf_% -l -t *.*  > chkem.log
..\%_nl_% -d chkem.log chkem.log
if exist chkem.bk! del chkem.bk!

%_ck_% -r -v

%_arc_% QDASTRO *.*
move QDASTRO.%_ext_% ..
cd..

%_cs_% -b -c -x *.* > qdtools.crc
%_nl_% -d .log     qdtools.crc
%_nl_% -d .crc     qdtools.crc
%_nl_% -d .md5     qdtools.crc
%_nl_% -d .sha     qdtools.crc
%_nl_% -d .bk!     qdtools.crc
%_nl_% -d .%_ext_% qdtools.crc

%_cs_% -b -m -x *.* > qdtools.md5
%_nl_% -d .log     qdtools.md5
%_nl_% -d .crc     qdtools.md5
%_nl_% -d .md5     qdtools.md5
%_nl_% -d .sha     qdtools.md5
%_nl_% -d .bk!     qdtools.md5
%_nl_% -d .%_ext_% qdtools.md5

goto nosha

%_cs_% -b -$ -x *.* > qdtools.sha
%_nl_% -d .log     qdtools.sha
%_nl_% -d .crc     qdtools.sha
%_nl_% -d .md5     qdtools.sha
%_nl_% -d .sha     qdtools.sha
%_nl_% -d .bk!     qdtools.sha
%_nl_% -d .%_ext_% qdtools.sha

:nosha

if exist qdtools.bk! del qdtools.bk!

%_dt_% -y %_frozen_% *.*
%_dt_% -y %_astro_%  QDASTRO.*

rem added safety against tampering
%_lf_% -l -t *.%_ext_%  > chkem.log

%_ck_% -r -v

if exist chkem.bk! del chkem.bk!
%_dt_% -y %_frozen_% chkem.log

%_arc_% qdtools *.txt
%_arc_% qdtools *.bat
%_arc_% qdtools *.log
%_arc_% qdtools *.crc
%_arc_% qdtools *.md5
%_arc_% qdtools *.sha
%_arc_% qdtools *.pbp
%_arc_% qdtools chkem.exe
%_arc_% qdtools unzip.*
%_arc_% qdtools zip.*

REM DIRBAT *.* -d "$p_arc_$p -n qdtools $n.zip"

%_arc_% qdtools FILE.%_ext_%
%_arc_% qdtools FILE_S.%_ext_%
%_arc_% qdtools TEXT.%_ext_%
%_arc_% qdtools TEXT_S.%_ext_%
%_arc_% qdtools VIDEO.%_ext_%
%_arc_% qdtools VIDEO_S.%_ext_%
%_arc_% qdtools MISC.%_ext_%
%_arc_% qdtools MISC_S.%_ext_%
%_arc_% qdtools HACK.%_ext_%
%_arc_% qdtools HACK_S.%_ext_%
%_arc_% qdtools FUN.%_ext_%
%_arc_% qdtools FUN_S.%_ext_%
%_arc_% qdtools WIN31.%_ext_%
%_arc_% qdtools M2LIB_S.%_ext_%
%_arc_% qdtools PBLIB_S.%_ext_%
%_arc_% qdtools WIN31_S.%_ext_%
%_arc_% qdtools BATDOS.%_ext_%
%_arc_% qdtools BAT98SE.%_ext_%
%_arc_% qdtools BATXP.%_ext_%
%_arc_% qdtools QDASTRO.%_ext_%

rem %_dt_% -y %_frozen_% QDTOOLS.%_ext_%


goto end

:syntax
echo.
echo Syntax : %0 QD [CHK]
echo.
echo Note you may edit this batch to change _arc_ environment variable value.
echo.
goto end

rem private ! ;-) hand-generated, ND7, etc. !
rem use default with because it will be deleted !

:chk

with -s readme?.txt "del $c"
with -s *.doc       "del $c"
with -s *.fon       "del $c"
with -s *.dat       "del $c"
with -s *.ini       "del $c"
with -s *.pcx       "del $c"
with -s *.dm        "del $c"
with -s *.pbp       "del $c"

with -s *.exe "move $c ."
with -s *.glo "move $c ."
with -s *.tx  "move $c ."
with -s *.bin "move $c ."
with -s *.wav "move $c ."

rem archived

del VIEWPCX.EXE
del RESTAMP.EXE
del SPLINES.EXE
del MD5DEMO.EXE
del SHADEMO.EXE
del SHUTTLE.EXE

call listid /db /s . f:\uc\bat
call delthem
call listid /db /s . f:\uc\tools
call delthem
call listid /db /s . f:\uc\fun
call delthem
call listid /db /s . f:\uc\modula
call delthem
call listid /db /s . f:\uc\pb
call delthem
call listid /db /s . f:\uc\wtools
call delthem
call listid /db /s . f:\uc\wfun
call delthem

call listid /db /s . c:\bat
call delthem

echo off
if exist delthem.bat del delthem.bat
goto end

:end
set _frozen_=
set _astro_=
set _ext_=
set _arc_=
set _lf_=
set _dt_=
set _cs_=
set _nl_=
set _wi_=
set _ck_=